From 930475000d9cf0b1f9753bf5ecdf78b70675ca70 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 18 Nov 2022 19:49:37 +0000 Subject: [PATCH 1/3] feat: added cx_current_page field to AutomatedAgentReply docs: clarified docs for Sentiment PiperOrigin-RevId: 489494136 Source-Link: https://github.com/googleapis/googleapis/commit/813e2fa430c3e13227529573cfe3f5c852abb559 Source-Link: https://github.com/googleapis/googleapis-gen/commit/dcf495943f59026b392927c19c652f61bd1f9869 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRpYWxvZ2Zsb3cvLk93bEJvdC55YW1sIiwiaCI6ImRjZjQ5NTk0M2Y1OTAyNmIzOTI5MjdjMTljNjUyZjYxYmQxZjk4NjkifQ== --- .../google-cloud-dialogflow/v2/.eslintignore | 7 + .../google-cloud-dialogflow/v2/.eslintrc.json | 3 + .../google-cloud-dialogflow/v2/.gitignore | 14 + .../google-cloud-dialogflow/v2/.jsdoc.js | 55 + .../google-cloud-dialogflow/v2/.mocharc.js | 33 + .../google-cloud-dialogflow/v2/.prettierrc.js | 22 + .../google-cloud-dialogflow/v2/README.md | 1 + .../v2/linkinator.config.json | 16 + .../google-cloud-dialogflow/v2/package.json | 80 + .../google/cloud/dialogflow/v2/agent.proto | 559 ++ .../cloud/dialogflow/v2/answer_record.proto | 294 + .../cloud/dialogflow/v2/audio_config.proto | 452 ++ .../google/cloud/dialogflow/v2/context.proto | 331 ++ .../cloud/dialogflow/v2/conversation.proto | 357 ++ .../dialogflow/v2/conversation_dataset.proto | 320 ++ .../dialogflow/v2/conversation_event.proto | 85 + .../dialogflow/v2/conversation_model.proto | 653 +++ .../dialogflow/v2/conversation_profile.proto | 753 +++ .../google/cloud/dialogflow/v2/document.proto | 636 +++ .../cloud/dialogflow/v2/entity_type.proto | 613 +++ .../cloud/dialogflow/v2/environment.proto | 390 ++ .../cloud/dialogflow/v2/fulfillment.proto | 177 + .../google/cloud/dialogflow/v2/gcs.proto | 45 + .../v2/human_agent_assistant_event.proto | 43 + .../google/cloud/dialogflow/v2/intent.proto | 1111 ++++ .../cloud/dialogflow/v2/knowledge_base.proto | 262 + .../cloud/dialogflow/v2/participant.proto | 1000 ++++ .../google/cloud/dialogflow/v2/session.proto | 701 +++ .../dialogflow/v2/session_entity_type.proto | 313 ++ .../dialogflow/v2/validation_result.proto | 74 + .../google/cloud/dialogflow/v2/version.proto | 267 + .../google/cloud/dialogflow/v2/webhook.proto | 144 + .../generated/v2/agents.delete_agent.js | 62 + .../generated/v2/agents.export_agent.js | 76 + .../samples/generated/v2/agents.get_agent.js | 62 + .../v2/agents.get_validation_result.js | 70 + .../generated/v2/agents.import_agent.js | 77 + .../generated/v2/agents.restore_agent.js | 77 + .../generated/v2/agents.search_agents.js | 73 + .../samples/generated/v2/agents.set_agent.js | 65 + .../generated/v2/agents.train_agent.js | 63 + .../v2/answer_records.list_answer_records.js | 85 + .../v2/answer_records.update_answer_record.js | 66 + .../generated/v2/contexts.create_context.js | 71 + .../v2/contexts.delete_all_contexts.js | 66 + .../generated/v2/contexts.delete_context.js | 66 + .../generated/v2/contexts.get_context.js | 66 + .../generated/v2/contexts.list_contexts.js | 77 + .../generated/v2/contexts.update_context.js | 65 + ...on_datasets.create_conversation_dataset.js | 68 + ...on_datasets.delete_conversation_dataset.js | 64 + ...ation_datasets.get_conversation_dataset.js | 63 + ...ation_datasets.import_conversation_data.js | 69 + ...ion_datasets.list_conversation_datasets.js | 73 + ...sation_models.create_conversation_model.js | 67 + ...ls.create_conversation_model_evaluation.js | 69 + ...sation_models.delete_conversation_model.js | 63 + ...sation_models.deploy_conversation_model.js | 63 + ...versation_models.get_conversation_model.js | 62 + ...odels.get_conversation_model_evaluation.js | 63 + ...els.list_conversation_model_evaluations.js | 73 + ...rsation_models.list_conversation_models.js | 73 + ...tion_models.undeploy_conversation_model.js | 63 + ...rofiles.clear_suggestion_feature_config.js | 75 + ...on_profiles.create_conversation_profile.js | 67 + ...on_profiles.delete_conversation_profile.js | 63 + ...ation_profiles.get_conversation_profile.js | 63 + ...ion_profiles.list_conversation_profiles.js | 73 + ..._profiles.set_suggestion_feature_config.js | 75 + ...on_profiles.update_conversation_profile.js | 66 + .../v2/conversations.complete_conversation.js | 63 + .../v2/conversations.create_conversation.js | 79 + .../v2/conversations.get_conversation.js | 63 + .../v2/conversations.list_conversations.js | 91 + .../v2/conversations.list_messages.js | 84 + .../generated/v2/documents.create_document.js | 69 + .../generated/v2/documents.delete_document.js | 64 + .../generated/v2/documents.export_document.js | 78 + .../generated/v2/documents.get_document.js | 63 + .../v2/documents.import_documents.js | 82 + .../generated/v2/documents.list_documents.js | 92 + .../generated/v2/documents.reload_document.js | 81 + .../generated/v2/documents.update_document.js | 68 + .../v2/entity_types.batch_create_entities.js | 76 + .../v2/entity_types.batch_delete_entities.js | 78 + .../entity_types.batch_delete_entity_types.js | 69 + .../v2/entity_types.batch_update_entities.js | 80 + .../entity_types.batch_update_entity_types.js | 86 + .../v2/entity_types.create_entity_type.js | 75 + .../v2/entity_types.delete_entity_type.js | 62 + .../v2/entity_types.get_entity_type.js | 70 + .../v2/entity_types.list_entity_types.js | 81 + .../v2/entity_types.update_entity_type.js | 73 + .../v2/environments.create_environment.js | 74 + .../v2/environments.delete_environment.js | 66 + .../v2/environments.get_environment.js | 66 + .../environments.get_environment_history.js | 77 + .../v2/environments.list_environments.js | 75 + .../v2/environments.update_environment.js | 73 + .../v2/fulfillments.get_fulfillment.js | 62 + .../v2/fulfillments.update_fulfillment.js | 67 + .../v2/intents.batch_delete_intents.js | 69 + .../v2/intents.batch_update_intents.js | 89 + .../generated/v2/intents.create_intent.js | 79 + .../generated/v2/intents.delete_intent.js | 63 + .../generated/v2/intents.get_intent.js | 74 + .../generated/v2/intents.list_intents.js | 92 + .../generated/v2/intents.update_intent.js | 77 + .../knowledge_bases.create_knowledge_base.js | 67 + .../knowledge_bases.delete_knowledge_base.js | 68 + .../v2/knowledge_bases.get_knowledge_base.js | 63 + .../knowledge_bases.list_knowledge_bases.js | 95 + .../knowledge_bases.update_knowledge_base.js | 67 + .../v2/participants.analyze_content.js | 101 + .../v2/participants.create_participant.js | 68 + .../v2/participants.get_participant.js | 63 + .../v2/participants.list_participants.js | 74 + .../participants.streaming_analyze_content.js | 125 + .../v2/participants.suggest_articles.js | 80 + .../v2/participants.suggest_faq_answers.js | 80 + .../v2/participants.suggest_smart_replies.js | 82 + .../v2/participants.update_participant.js | 66 + ...entity_types.create_session_entity_type.js | 71 + ...entity_types.delete_session_entity_type.js | 67 + ...on_entity_types.get_session_entity_type.js | 67 + ..._entity_types.list_session_entity_types.js | 77 + ...entity_types.update_session_entity_type.js | 65 + .../generated/v2/sessions.detect_intent.js | 108 + .../v2/sessions.streaming_detect_intent.js | 123 + ...t_metadata.google.cloud.dialogflow.v2.json | 4731 +++++++++++++++++ .../generated/v2/versions.create_version.js | 69 + .../generated/v2/versions.delete_version.js | 65 + .../generated/v2/versions.get_version.js | 65 + .../generated/v2/versions.list_versions.js | 75 + .../generated/v2/versions.update_version.js | 70 + .../google-cloud-dialogflow/v2/src/index.ts | 57 + .../v2/src/v2/agents_client.ts | 3664 +++++++++++++ .../v2/src/v2/agents_client_config.json | 74 + .../v2/src/v2/agents_proto_list.json | 25 + .../v2/src/v2/answer_records_client.ts | 2767 ++++++++++ .../src/v2/answer_records_client_config.json | 39 + .../v2/src/v2/answer_records_proto_list.json | 25 + .../v2/src/v2/contexts_client.ts | 3089 +++++++++++ .../v2/src/v2/contexts_client_config.json | 59 + .../v2/src/v2/contexts_proto_list.json | 25 + .../v2/src/v2/conversation_datasets_client.ts | 3303 ++++++++++++ .../conversation_datasets_client_config.json | 54 + .../v2/conversation_datasets_proto_list.json | 25 + .../v2/src/v2/conversation_models_client.ts | 3725 +++++++++++++ .../v2/conversation_models_client_config.json | 74 + .../v2/conversation_models_proto_list.json | 25 + .../v2/src/v2/conversation_profiles_client.ts | 3445 ++++++++++++ .../conversation_profiles_client_config.json | 64 + .../v2/conversation_profiles_proto_list.json | 25 + .../v2/src/v2/conversations_client.ts | 3175 +++++++++++ .../src/v2/conversations_client_config.json | 54 + .../v2/src/v2/conversations_proto_list.json | 25 + .../v2/src/v2/documents_client.ts | 3693 +++++++++++++ .../v2/src/v2/documents_client_config.json | 69 + .../v2/src/v2/documents_proto_list.json | 25 + .../v2/src/v2/entity_types_client.ts | 3809 +++++++++++++ .../v2/src/v2/entity_types_client_config.json | 79 + .../v2/src/v2/entity_types_proto_list.json | 25 + .../v2/src/v2/environments_client.ts | 3189 +++++++++++ .../v2/src/v2/environments_client_config.json | 59 + .../v2/src/v2/environments_proto_list.json | 25 + .../v2/src/v2/fulfillments_client.ts | 2589 +++++++++ .../v2/src/v2/fulfillments_client_config.json | 39 + .../v2/src/v2/fulfillments_proto_list.json | 25 + .../v2/src/v2/gapic_metadata.json | 1329 +++++ .../v2/src/v2/index.ts | 35 + .../v2/src/v2/intents_client.ts | 3477 ++++++++++++ .../v2/src/v2/intents_client_config.json | 64 + .../v2/src/v2/intents_proto_list.json | 25 + .../v2/src/v2/knowledge_bases_client.ts | 3036 +++++++++++ .../src/v2/knowledge_bases_client_config.json | 54 + .../v2/src/v2/knowledge_bases_proto_list.json | 25 + .../v2/src/v2/participants_client.ts | 3294 ++++++++++++ .../v2/src/v2/participants_client_config.json | 74 + .../v2/src/v2/participants_proto_list.json | 25 + .../v2/src/v2/session_entity_types_client.ts | 3036 +++++++++++ .../session_entity_types_client_config.json | 54 + .../v2/session_entity_types_proto_list.json | 25 + .../v2/src/v2/sessions_client.ts | 2856 ++++++++++ .../v2/src/v2/sessions_client_config.json | 39 + .../v2/src/v2/sessions_proto_list.json | 25 + .../v2/src/v2/versions_client.ts | 2979 +++++++++++ .../v2/src/v2/versions_client_config.json | 54 + .../v2/src/v2/versions_proto_list.json | 25 + .../system-test/fixtures/sample/src/index.js | 43 + .../system-test/fixtures/sample/src/index.ts | 128 + .../v2/system-test/install.ts | 49 + .../v2/test/gapic_agents_v2.ts | 3766 +++++++++++++ .../v2/test/gapic_answer_records_v2.ts | 2555 +++++++++ .../v2/test/gapic_contexts_v2.ts | 3025 +++++++++++ .../v2/test/gapic_conversation_datasets_v2.ts | 3322 ++++++++++++ .../v2/test/gapic_conversation_models_v2.ts | 3945 ++++++++++++++ .../v2/test/gapic_conversation_profiles_v2.ts | 3504 ++++++++++++ .../v2/test/gapic_conversations_v2.ts | 3012 +++++++++++ .../v2/test/gapic_documents_v2.ts | 3750 +++++++++++++ .../v2/test/gapic_entity_types_v2.ts | 3920 ++++++++++++++ .../v2/test/gapic_environments_v2.ts | 3124 +++++++++++ .../v2/test/gapic_fulfillments_v2.ts | 2361 ++++++++ .../v2/test/gapic_intents_v2.ts | 3458 ++++++++++++ .../v2/test/gapic_knowledge_bases_v2.ts | 2879 ++++++++++ .../v2/test/gapic_participants_v2.ts | 3276 ++++++++++++ .../v2/test/gapic_session_entity_types_v2.ts | 2917 ++++++++++ .../v2/test/gapic_sessions_v2.ts | 2524 +++++++++ .../v2/test/gapic_versions_v2.ts | 2879 ++++++++++ .../google-cloud-dialogflow/v2/tsconfig.json | 19 + .../v2/webpack.config.js | 64 + .../v2beta1/.eslintignore | 7 + .../v2beta1/.eslintrc.json | 3 + .../v2beta1/.gitignore | 14 + .../google-cloud-dialogflow/v2beta1/.jsdoc.js | 55 + .../v2beta1/.mocharc.js | 33 + .../v2beta1/.prettierrc.js | 22 + .../google-cloud-dialogflow/v2beta1/README.md | 1 + .../v2beta1/linkinator.config.json | 16 + .../v2beta1/package.json | 78 + .../cloud/dialogflow/v2beta1/agent.proto | 578 ++ .../dialogflow/v2beta1/answer_record.proto | 325 ++ .../dialogflow/v2beta1/audio_config.proto | 462 ++ .../cloud/dialogflow/v2beta1/context.proto | 375 ++ .../dialogflow/v2beta1/conversation.proto | 494 ++ .../v2beta1/conversation_event.proto | 85 + .../v2beta1/conversation_profile.proto | 735 +++ .../cloud/dialogflow/v2beta1/document.proto | 612 +++ .../dialogflow/v2beta1/entity_type.proto | 639 +++ .../dialogflow/v2beta1/environment.proto | 372 ++ .../dialogflow/v2beta1/fulfillment.proto | 180 + .../google/cloud/dialogflow/v2beta1/gcs.proto | 55 + .../v2beta1/human_agent_assistant_event.proto | 50 + .../cloud/dialogflow/v2beta1/intent.proto | 1453 +++++ .../dialogflow/v2beta1/knowledge_base.proto | 278 + .../dialogflow/v2beta1/participant.proto | 1429 +++++ .../cloud/dialogflow/v2beta1/session.proto | 841 +++ .../v2beta1/session_entity_type.proto | 351 ++ .../v2beta1/validation_result.proto | 74 + .../cloud/dialogflow/v2beta1/version.proto | 261 + .../cloud/dialogflow/v2beta1/webhook.proto | 164 + .../generated/v2beta1/agents.delete_agent.js | 63 + .../generated/v2beta1/agents.export_agent.js | 77 + .../generated/v2beta1/agents.get_agent.js | 63 + .../v2beta1/agents.get_validation_result.js | 71 + .../generated/v2beta1/agents.import_agent.js | 78 + .../generated/v2beta1/agents.restore_agent.js | 78 + .../generated/v2beta1/agents.search_agents.js | 74 + .../generated/v2beta1/agents.set_agent.js | 65 + .../generated/v2beta1/agents.train_agent.js | 64 + .../answer_records.get_answer_record.js | 62 + .../answer_records.list_answer_records.js | 83 + .../answer_records.update_answer_record.js | 65 + .../v2beta1/contexts.create_context.js | 77 + .../v2beta1/contexts.delete_all_contexts.js | 72 + .../v2beta1/contexts.delete_context.js | 73 + .../generated/v2beta1/contexts.get_context.js | 73 + .../v2beta1/contexts.list_contexts.js | 83 + .../v2beta1/contexts.update_context.js | 65 + ...rofiles.clear_suggestion_feature_config.js | 75 + ...on_profiles.create_conversation_profile.js | 67 + ...on_profiles.delete_conversation_profile.js | 63 + ...ation_profiles.get_conversation_profile.js | 63 + ...ion_profiles.list_conversation_profiles.js | 73 + ..._profiles.set_suggestion_feature_config.js | 75 + ...on_profiles.update_conversation_profile.js | 66 + .../conversations.batch_create_messages.js | 70 + .../conversations.complete_conversation.js | 63 + .../conversations.create_conversation.js | 79 + .../v2beta1/conversations.get_conversation.js | 63 + .../conversations.list_conversations.js | 91 + .../v2beta1/conversations.list_messages.js | 84 + ...versations.suggest_conversation_summary.js | 77 + .../v2beta1/documents.create_document.js | 74 + .../v2beta1/documents.delete_document.js | 64 + .../v2beta1/documents.get_document.js | 63 + .../v2beta1/documents.import_documents.js | 82 + .../v2beta1/documents.list_documents.js | 92 + .../v2beta1/documents.reload_document.js | 74 + .../v2beta1/documents.update_document.js | 68 + .../entity_types.batch_create_entities.js | 79 + .../entity_types.batch_delete_entities.js | 81 + .../entity_types.batch_delete_entity_types.js | 71 + .../entity_types.batch_update_entities.js | 83 + .../entity_types.batch_update_entity_types.js | 88 + .../entity_types.create_entity_type.js | 77 + .../entity_types.delete_entity_type.js | 65 + .../v2beta1/entity_types.get_entity_type.js | 73 + .../v2beta1/entity_types.list_entity_types.js | 83 + .../entity_types.update_entity_type.js | 73 + .../environments.create_environment.js | 74 + .../environments.delete_environment.js | 65 + .../v2beta1/environments.get_environment.js | 65 + .../environments.get_environment_history.js | 76 + .../v2beta1/environments.list_environments.js | 75 + .../environments.update_environment.js | 73 + .../v2beta1/fulfillments.get_fulfillment.js | 64 + .../fulfillments.update_fulfillment.js | 67 + .../v2beta1/intents.batch_delete_intents.js | 71 + .../v2beta1/intents.batch_update_intents.js | 91 + .../v2beta1/intents.create_intent.js | 81 + .../v2beta1/intents.delete_intent.js | 65 + .../generated/v2beta1/intents.get_intent.js | 76 + .../generated/v2beta1/intents.list_intents.js | 92 + .../v2beta1/intents.update_intent.js | 77 + .../knowledge_bases.create_knowledge_base.js | 67 + .../knowledge_bases.delete_knowledge_base.js | 68 + .../knowledge_bases.get_knowledge_base.js | 63 + .../knowledge_bases.list_knowledge_bases.js | 95 + .../knowledge_bases.update_knowledge_base.js | 67 + .../v2beta1/participants.analyze_content.js | 135 + .../participants.compile_suggestion.js | 75 + .../participants.create_participant.js | 68 + .../v2beta1/participants.get_participant.js | 63 + .../v2beta1/participants.list_participants.js | 74 + .../v2beta1/participants.list_suggestions.js | 83 + .../participants.streaming_analyze_content.js | 140 + .../v2beta1/participants.suggest_articles.js | 80 + .../participants.suggest_faq_answers.js | 80 + .../participants.suggest_smart_replies.js | 82 + .../participants.update_participant.js | 66 + ...entity_types.create_session_entity_type.js | 78 + ...entity_types.delete_session_entity_type.js | 74 + ...on_entity_types.get_session_entity_type.js | 73 + ..._entity_types.list_session_entity_types.js | 84 + ...entity_types.update_session_entity_type.js | 65 + .../v2beta1/sessions.detect_intent.js | 114 + .../sessions.streaming_detect_intent.js | 130 + ...adata.google.cloud.dialogflow.v2beta1.json | 4327 +++++++++++++++ .../v2beta1/versions.create_version.js | 69 + .../v2beta1/versions.delete_version.js | 65 + .../generated/v2beta1/versions.get_version.js | 65 + .../v2beta1/versions.list_versions.js | 75 + .../v2beta1/versions.update_version.js | 70 + .../v2beta1/src/index.ts | 53 + .../v2beta1/src/v2beta1/agents_client.ts | 3414 ++++++++++++ .../src/v2beta1/agents_client_config.json | 74 + .../src/v2beta1/agents_proto_list.json | 23 + .../src/v2beta1/answer_records_client.ts | 2577 +++++++++ .../v2beta1/answer_records_client_config.json | 44 + .../v2beta1/answer_records_proto_list.json | 23 + .../v2beta1/src/v2beta1/contexts_client.ts | 2880 ++++++++++ .../src/v2beta1/contexts_client_config.json | 59 + .../src/v2beta1/contexts_proto_list.json | 23 + .../v2beta1/conversation_profiles_client.ts | 3185 +++++++++++ .../conversation_profiles_client_config.json | 64 + .../conversation_profiles_proto_list.json | 23 + .../src/v2beta1/conversations_client.ts | 3079 +++++++++++ .../v2beta1/conversations_client_config.json | 64 + .../src/v2beta1/conversations_proto_list.json | 23 + .../v2beta1/src/v2beta1/documents_client.ts | 3331 ++++++++++++ .../src/v2beta1/documents_client_config.json | 64 + .../src/v2beta1/documents_proto_list.json | 23 + .../src/v2beta1/entity_types_client.ts | 3575 +++++++++++++ .../v2beta1/entity_types_client_config.json | 79 + .../src/v2beta1/entity_types_proto_list.json | 23 + .../src/v2beta1/environments_client.ts | 2910 ++++++++++ .../v2beta1/environments_client_config.json | 59 + .../src/v2beta1/environments_proto_list.json | 23 + .../src/v2beta1/fulfillments_client.ts | 2332 ++++++++ .../v2beta1/fulfillments_client_config.json | 39 + .../src/v2beta1/fulfillments_proto_list.json | 23 + .../v2beta1/src/v2beta1/gapic_metadata.json | 1193 +++++ .../v2beta1/src/v2beta1/index.ts | 33 + .../v2beta1/src/v2beta1/intents_client.ts | 3233 +++++++++++ .../src/v2beta1/intents_client_config.json | 64 + .../src/v2beta1/intents_proto_list.json | 23 + .../src/v2beta1/knowledge_bases_client.ts | 2791 ++++++++++ .../knowledge_bases_client_config.json | 54 + .../v2beta1/knowledge_bases_proto_list.json | 23 + .../src/v2beta1/participants_client.ts | 3398 ++++++++++++ .../v2beta1/participants_client_config.json | 84 + .../src/v2beta1/participants_proto_list.json | 23 + .../v2beta1/session_entity_types_client.ts | 2823 ++++++++++ .../session_entity_types_client_config.json | 54 + .../session_entity_types_proto_list.json | 23 + .../v2beta1/src/v2beta1/sessions_client.ts | 2602 +++++++++ .../src/v2beta1/sessions_client_config.json | 39 + .../src/v2beta1/sessions_proto_list.json | 23 + .../v2beta1/src/v2beta1/versions_client.ts | 2712 ++++++++++ .../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 | 3536 ++++++++++++ .../test/gapic_answer_records_v2beta1.ts | 2441 +++++++++ .../v2beta1/test/gapic_contexts_v2beta1.ts | 2795 ++++++++++ .../gapic_conversation_profiles_v2beta1.ts | 3274 ++++++++++++ .../test/gapic_conversations_v2beta1.ts | 2998 +++++++++++ .../v2beta1/test/gapic_documents_v2beta1.ts | 3366 ++++++++++++ .../test/gapic_entity_types_v2beta1.ts | 3690 +++++++++++++ .../test/gapic_environments_v2beta1.ts | 2894 ++++++++++ .../test/gapic_fulfillments_v2beta1.ts | 2131 ++++++++ .../v2beta1/test/gapic_intents_v2beta1.ts | 3228 +++++++++++ .../test/gapic_knowledge_bases_v2beta1.ts | 2649 +++++++++ .../test/gapic_participants_v2beta1.ts | 3421 ++++++++++++ .../gapic_session_entity_types_v2beta1.ts | 2687 ++++++++++ .../v2beta1/test/gapic_sessions_v2beta1.ts | 2294 ++++++++ .../v2beta1/test/gapic_versions_v2beta1.ts | 2649 +++++++++ .../v2beta1/tsconfig.json | 19 + .../v2beta1/webpack.config.js | 64 + 402 files changed, 247527 insertions(+) create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/.eslintignore create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/.gitignore create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/README.md create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/linkinator.config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/package.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/agent.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/answer_record.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/audio_config.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/context.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_dataset.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_event.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_model.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_profile.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/document.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/entity_type.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/environment.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/fulfillment.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/gcs.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/intent.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/knowledge_base.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/participant.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/session.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/session_entity_type.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/validation_result.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/version.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/webhook.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.delete_agent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.export_agent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.get_agent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.get_validation_result.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.import_agent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.restore_agent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.search_agents.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.set_agent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.train_agent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/answer_records.list_answer_records.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/answer_records.update_answer_record.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.create_context.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.delete_all_contexts.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.delete_context.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.get_context.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.list_contexts.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.update_context.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.create_conversation_dataset.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.delete_conversation_dataset.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.get_conversation_dataset.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.import_conversation_data.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.list_conversation_datasets.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.create_conversation_model.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.create_conversation_model_evaluation.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.delete_conversation_model.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.deploy_conversation_model.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.get_conversation_model.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.get_conversation_model_evaluation.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.list_conversation_model_evaluations.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.list_conversation_models.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.undeploy_conversation_model.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.clear_suggestion_feature_config.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.create_conversation_profile.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.delete_conversation_profile.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.get_conversation_profile.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.list_conversation_profiles.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.set_suggestion_feature_config.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.update_conversation_profile.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.complete_conversation.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.create_conversation.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.get_conversation.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.list_conversations.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.list_messages.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.create_document.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.delete_document.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.export_document.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.get_document.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.import_documents.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.list_documents.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.reload_document.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.update_document.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_create_entities.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_delete_entities.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_delete_entity_types.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_update_entities.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_update_entity_types.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.create_entity_type.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.delete_entity_type.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.get_entity_type.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.list_entity_types.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.update_entity_type.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.create_environment.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.delete_environment.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.get_environment.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.get_environment_history.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.list_environments.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.update_environment.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/fulfillments.get_fulfillment.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/fulfillments.update_fulfillment.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.batch_delete_intents.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.batch_update_intents.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.create_intent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.delete_intent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.get_intent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.list_intents.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.update_intent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.create_knowledge_base.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.delete_knowledge_base.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.get_knowledge_base.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.list_knowledge_bases.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.update_knowledge_base.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.analyze_content.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.create_participant.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.get_participant.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.list_participants.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.streaming_analyze_content.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.suggest_articles.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.suggest_faq_answers.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.suggest_smart_replies.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.update_participant.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.create_session_entity_type.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.delete_session_entity_type.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.get_session_entity_type.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.list_session_entity_types.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.update_session_entity_type.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/sessions.detect_intent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/sessions.streaming_detect_intent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/snippet_metadata.google.cloud.dialogflow.v2.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.create_version.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.delete_version.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.get_version.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.list_versions.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.update_version.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/index.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/agents_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/agents_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/agents_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/answer_records_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/answer_records_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/answer_records_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/contexts_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/contexts_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/contexts_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_datasets_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_datasets_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_datasets_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_models_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_models_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_models_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_profiles_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_profiles_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_profiles_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversations_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversations_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversations_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/documents_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/documents_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/documents_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/entity_types_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/entity_types_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/entity_types_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/environments_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/environments_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/environments_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/fulfillments_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/fulfillments_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/fulfillments_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/index.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/intents_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/intents_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/intents_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/knowledge_bases_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/knowledge_bases_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/knowledge_bases_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/participants_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/participants_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/participants_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/session_entity_types_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/session_entity_types_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/session_entity_types_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/sessions_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/sessions_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/sessions_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/versions_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/versions_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/versions_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_agents_v2.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_answer_records_v2.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_contexts_v2.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_conversation_datasets_v2.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_conversation_models_v2.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_conversation_profiles_v2.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_conversations_v2.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_documents_v2.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_entity_types_v2.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_environments_v2.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_fulfillments_v2.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_intents_v2.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_knowledge_bases_v2.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_participants_v2.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_session_entity_types_v2.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_sessions_v2.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_versions_v2.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/.gitignore create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/README.md create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/linkinator.config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/package.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/agent.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/answer_record.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/audio_config.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/context.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_event.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/document.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/entity_type.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/environment.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/fulfillment.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/gcs.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/intent.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/participant.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/session.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/validation_result.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/version.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/webhook.proto create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.delete_agent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.export_agent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.get_agent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.get_validation_result.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.import_agent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.restore_agent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.search_agents.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.set_agent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.train_agent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/answer_records.get_answer_record.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/answer_records.list_answer_records.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/answer_records.update_answer_record.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.create_context.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.delete_all_contexts.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.delete_context.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.get_context.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.list_contexts.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.update_context.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.clear_suggestion_feature_config.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.create_conversation_profile.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.delete_conversation_profile.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.get_conversation_profile.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.list_conversation_profiles.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.set_suggestion_feature_config.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.update_conversation_profile.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.batch_create_messages.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.complete_conversation.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.create_conversation.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.get_conversation.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.list_conversations.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.list_messages.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.suggest_conversation_summary.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.create_document.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.delete_document.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.get_document.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.import_documents.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.list_documents.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.reload_document.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.update_document.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_create_entities.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_delete_entities.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_delete_entity_types.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_update_entities.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_update_entity_types.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.create_entity_type.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.delete_entity_type.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.get_entity_type.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.list_entity_types.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.update_entity_type.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.create_environment.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.delete_environment.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.get_environment.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.get_environment_history.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.list_environments.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.update_environment.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/fulfillments.get_fulfillment.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/fulfillments.update_fulfillment.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.batch_delete_intents.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.batch_update_intents.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.create_intent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.delete_intent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.get_intent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.list_intents.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.update_intent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.create_knowledge_base.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.delete_knowledge_base.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.get_knowledge_base.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.list_knowledge_bases.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.update_knowledge_base.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.analyze_content.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.compile_suggestion.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.create_participant.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.get_participant.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.list_participants.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.list_suggestions.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.streaming_analyze_content.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.suggest_articles.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.suggest_faq_answers.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.suggest_smart_replies.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.update_participant.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.create_session_entity_type.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.delete_session_entity_type.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.get_session_entity_type.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.list_session_entity_types.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.update_session_entity_type.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/sessions.detect_intent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/sessions.streaming_detect_intent.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/snippet_metadata.google.cloud.dialogflow.v2beta1.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.create_version.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.delete_version.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.get_version.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.list_versions.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.update_version.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/agents_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/agents_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/agents_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/answer_records_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/answer_records_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/answer_records_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/contexts_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/contexts_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/contexts_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversation_profiles_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversation_profiles_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversation_profiles_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversations_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversations_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversations_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/documents_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/documents_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/documents_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/entity_types_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/entity_types_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/entity_types_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/environments_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/environments_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/environments_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/fulfillments_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/fulfillments_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/fulfillments_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/index.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/intents_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/intents_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/intents_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/knowledge_bases_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/knowledge_bases_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/knowledge_bases_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/participants_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/participants_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/participants_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/session_entity_types_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/session_entity_types_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/session_entity_types_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/sessions_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/sessions_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/sessions_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/versions_client.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/versions_client_config.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/versions_proto_list.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_agents_v2beta1.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_answer_records_v2beta1.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_contexts_v2beta1.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_conversation_profiles_v2beta1.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_conversations_v2beta1.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_documents_v2beta1.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_entity_types_v2beta1.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_environments_v2beta1.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_fulfillments_v2beta1.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_intents_v2beta1.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_knowledge_bases_v2beta1.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_participants_v2beta1.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_session_entity_types_v2beta1.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_sessions_v2beta1.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_versions_v2beta1.ts create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/webpack.config.js diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/.eslintignore b/owl-bot-staging/google-cloud-dialogflow/v2/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/.eslintrc.json b/owl-bot-staging/google-cloud-dialogflow/v2/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/.gitignore b/owl-bot-staging/google-cloud-dialogflow/v2/.gitignore new file mode 100644 index 00000000000..5d32b23782f --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/.jsdoc.js b/owl-bot-staging/google-cloud-dialogflow/v2/.jsdoc.js new file mode 100644 index 00000000000..fe4bcaa346d --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2022 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 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/dialogflow', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/.mocharc.js b/owl-bot-staging/google-cloud-dialogflow/v2/.mocharc.js new file mode 100644 index 00000000000..481c522b00f --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2022 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/google-cloud-dialogflow/v2/.prettierrc.js b/owl-bot-staging/google-cloud-dialogflow/v2/.prettierrc.js new file mode 100644 index 00000000000..494e147865d --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2022 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/google-cloud-dialogflow/v2/README.md b/owl-bot-staging/google-cloud-dialogflow/v2/README.md new file mode 100644 index 00000000000..f592662ac92 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/README.md @@ -0,0 +1 @@ +Dialogflow: Nodejs Client diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/linkinator.config.json b/owl-bot-staging/google-cloud-dialogflow/v2/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/package.json b/owl-bot-staging/google-cloud-dialogflow/v2/package.json new file mode 100644 index 00000000000..812938933df --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/package.json @@ -0,0 +1,80 @@ +{ + "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 datasets", + "conversation models", + "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/ && minifyProtoJson", + "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": "^3.5.2" + }, + "devDependencies": { + "@types/mocha": "^9.1.1", + "@types/node": "^16.11.62", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^3.6.11", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.0.3", + "mocha": "^10.0.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^14.0.0", + "ts-loader": "^8.4.0", + "typescript": "^4.8.3", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/agent.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/agent.proto new file mode 100644 index 00000000000..fa16a4c2af2 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/agent.proto @@ -0,0 +1,559 @@ +// Copyright 2022 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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // 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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse] + 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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // The operation only tracks when importing is complete, 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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // The operation only tracks when restoring is complete, 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; + + // Trial Edition, previously known as Standard Edition. + TIER_STANDARD = 1; + + // Essentials Edition, previously known as Enterprise Essential Edition. + TIER_ENTERPRISE = 2; + + // Essentials Edition (same as TIER_ENTERPRISE), previously known as + // Enterprise Plus Edition. + TIER_ENTERPRISE_PLUS = 3 [deprecated = true]; + } + + // 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. + // + // Dialogflow performs a write operation for the Cloud Storage object + // on the caller's behalf, so your request authentication must + // have write permissions for the object. For more information, see + // [Dialogflow access + // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + 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://". + // + // Dialogflow performs a read operation for the Cloud Storage object + // on the caller's behalf, so your request authentication must + // have read permissions for the object. For more information, see + // [Dialogflow access + // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + 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://". + // + // Dialogflow performs a read operation for the Cloud Storage object + // on the caller's behalf, so your request authentication must + // have read permissions for the object. For more information, see + // [Dialogflow access + // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + 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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/answer_record.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/answer_record.proto new file mode 100644 index 00000000000..14ab41e15ad --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/answer_record.proto @@ -0,0 +1,294 @@ +// Copyright 2022 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/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" + } + ]; + + // Optional. Filters to restrict results to specific answer records. + // + // Marked deprecated as it hasn't been, and isn't currently, supported. + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 2 [ + deprecated = true, + (google.api.field_behavior) = OPTIONAL + ]; + + // 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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/audio_config.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/audio_config.proto new file mode 100644 index 00000000000..b86a9d3a1d4 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/audio_config.proto @@ -0,0 +1,452 @@ +// Copyright 2022 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"; + +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"; +option (google.api.resource_definition) = { + type: "automl.googleapis.com/Model" + pattern: "projects/{project}/locations/{location}/models/{model}" +}; +option (google.api.resource_definition) = { + type: "speech.googleapis.com/PhraseSet" + pattern: "projects/{project}/locations/{location}/phraseSets/{phrase_set}" +}; + +// 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; +} + +// 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; +} + +// 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; +} + +// 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; +} + +// 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; +} + +// 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; +} + +// 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; +} + +// 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; +} + +// [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; +} + +// A wrapper of repeated TelephonyDtmf digits. +message TelephonyDtmfEvents { + // A sequence of TelephonyDtmf digits. + repeated TelephonyDtmf dtmf_events = 1; +} + +// Configures speech transcription for [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile]. +message SpeechToTextConfig { + // 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. + // If enhanced model variant is specified and an enhanced + // version of the specified model for the language does not exist, then it + // would emit an error. + SpeechModelVariant speech_model_variant = 1; + + // Which Speech model to select. Select the model best suited to your domain + // to get best results. If a model is not explicitly specified, then a default + // model is used. + // Refer to + // [Cloud Speech API + // documentation](https://cloud.google.com/speech-to-text/docs/basics#select-model) + // for more details. + string model = 2; +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/context.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/context.proto new file mode 100644 index 00000000000..53dc7874dd1 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/context.proto @@ -0,0 +1,331 @@ +// Copyright 2022 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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation.proto new file mode 100644 index 00000000000..6266354ae9a --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation.proto @@ -0,0 +1,357 @@ +// Copyright 2022 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/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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_dataset.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_dataset.proto new file mode 100644 index 00000000000..282bdda3923 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_dataset.proto @@ -0,0 +1,320 @@ +// Copyright 2022 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/gcs.proto"; +import "google/longrunning/operations.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 = "ConversationDatasetProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Conversation datasets. +// +// Conversation datasets contain raw conversation files and their +// customizable metadata that can be used for model training. +service ConversationDatasets { + 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 dataset. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [CreateConversationDatasetOperationMetadata][google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata] + // - `response`: [ConversationDataset][google.cloud.dialogflow.v2.ConversationDataset] + rpc CreateConversationDataset(CreateConversationDatasetRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*}/conversationDatasets" + body: "conversation_dataset" + }; + option (google.api.method_signature) = "parent,conversation_dataset"; + option (google.longrunning.operation_info) = { + response_type: "ConversationDataset" + metadata_type: "CreateConversationDatasetOperationMetadata" + }; + } + + // Retrieves the specified conversation dataset. + rpc GetConversationDataset(GetConversationDatasetRequest) returns (ConversationDataset) { + option (google.api.http) = { + get: "/v2/{name=projects/*/conversationDatasets/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/conversationDatasets/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Returns the list of all conversation datasets in the specified + // project and location. + rpc ListConversationDatasets(ListConversationDatasetsRequest) returns (ListConversationDatasetsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/conversationDatasets" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*}/conversationDatasets" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes the specified conversation dataset. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [DeleteConversationDatasetOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata] + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + rpc DeleteConversationDataset(DeleteConversationDatasetRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/locations/*/conversationDatasets/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "DeleteConversationDatasetOperationMetadata" + }; + } + + // Import data into the specified conversation dataset. Note that it + // is not allowed to import data to a conversation dataset that + // already has data in it. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [ImportConversationDataOperationMetadata][google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata] + // - `response`: [ImportConversationDataOperationResponse][google.cloud.dialogflow.v2.ImportConversationDataOperationResponse] + rpc ImportConversationData(ImportConversationDataRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/conversationDatasets/*}:importConversationData" + body: "*" + additional_bindings { + post: "/v2/{name=projects/*/locations/*/conversationDatasets/*}:importConversationData" + body: "*" + } + }; + option (google.longrunning.operation_info) = { + response_type: "ImportConversationDataOperationResponse" + metadata_type: "ImportConversationDataOperationMetadata" + }; + } +} + +// Represents metadata of a conversation. +message ConversationInfo { + // Optional. The language code of the conversation data within this dataset. See + // https://cloud.google.com/apis/design/standard_fields for more information. + // Supports all UTF-8 languages. + string language_code = 1 [(google.api.field_behavior) = OPTIONAL]; +} + +// Represents the configuration of importing a set of conversation files in +// Google Cloud Storage. +message InputConfig { + // Required. Where the data is from. + oneof source { + // The Cloud Storage URI has the form gs:////agent*.json. Wildcards are allowed and will be expanded into all + // matched JSON files, which will be read as one conversation per file. + GcsSources gcs_source = 1; + } +} + +// Represents a conversation dataset that a user imports raw data into. +// The data inside ConversationDataset can not be changed after +// ImportConversationData finishes (and calling ImportConversationData on a +// dataset that already has data is not allowed). +message ConversationDataset { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/ConversationDataset" + pattern: "projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}" + }; + + // Output only. ConversationDataset resource name. Format: + // `projects//locations//conversationDatasets/` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The display name of the dataset. Maximum of 64 bytes. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The description of the dataset. Maximum of 10000 bytes. + string description = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Creation time of this dataset. + google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Input configurations set during conversation data import. + InputConfig input_config = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Metadata set during conversation data import. + ConversationInfo conversation_info = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The number of conversations this conversation dataset contains. + int64 conversation_count = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request message for +// [ConversationDatasets.CreateConversationDataset][google.cloud.dialogflow.v2.ConversationDatasets.CreateConversationDataset]. +message CreateConversationDatasetRequest { + // Required. The project to create conversation dataset for. Format: + // `projects//locations/` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The conversation dataset to create. + ConversationDataset conversation_dataset = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for +// [ConversationDatasets.GetConversationDataset][google.cloud.dialogflow.v2.ConversationDatasets.GetConversationDataset]. +message GetConversationDatasetRequest { + // Required. The conversation dataset to retrieve. Format: + // `projects//locations//conversationDatasets/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationDataset" + } + ]; +} + +// The request message for +// [ConversationDatasets.ListConversationDatasets][google.cloud.dialogflow.v2.ConversationDatasets.ListConversationDatasets]. +message ListConversationDatasetsRequest { + // Required. The project and location name to list all conversation datasets for. + // Format: `projects//locations/` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/ConversationDataset" + } + ]; + + // Optional. Maximum number of conversation datasets 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 +// [ConversationDatasets.ListConversationDatasets][google.cloud.dialogflow.v2.ConversationDatasets.ListConversationDatasets]. +message ListConversationDatasetsResponse { + // The list of datasets to return. + repeated ConversationDataset conversation_datasets = 1; + + // The token to use 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 +// [ConversationDatasets.DeleteConversationDataset][google.cloud.dialogflow.v2.ConversationDatasets.DeleteConversationDataset]. +message DeleteConversationDatasetRequest { + // Required. The conversation dataset to delete. Format: + // `projects//locations//conversationDatasets/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationDataset" + } + ]; +} + +// The request message for [ConversationDatasets.ImportConversationData][google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData]. +message ImportConversationDataRequest { + // Required. Dataset resource name. Format: + // `projects//locations//conversationDatasets/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationDataset" + } + ]; + + // Required. Configuration describing where to import data from. + InputConfig input_config = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Metadata for a [ConversationDatasets.ImportConversationData][google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData] operation. +message ImportConversationDataOperationMetadata { + // The resource name of the imported conversation dataset. Format: + // `projects//locations//conversationDatasets/` + string conversation_dataset = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationDataset" + }]; + + // Partial failures are failures that don't fail the whole long running + // operation, e.g. single files that couldn't be read. + repeated google.rpc.Status partial_failures = 2; + + // Timestamp when import conversation data request was created. The time is + // measured on server side. + google.protobuf.Timestamp create_time = 3; +} + +// Response used for [ConversationDatasets.ImportConversationData][google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData] long +// running operation. +message ImportConversationDataOperationResponse { + // The resource name of the imported conversation dataset. Format: + // `projects//locations//conversationDatasets/` + string conversation_dataset = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationDataset" + }]; + + // Number of conversations imported successfully. + int32 import_count = 3; +} + +// Metadata for [ConversationDatasets][CreateConversationDataset]. +message CreateConversationDatasetOperationMetadata { + // The resource name of the conversation dataset that will be created. Format: + // `projects//locations//conversationDatasets/` + string conversation_dataset = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationDataset" + }]; +} + +// Metadata for [ConversationDatasets][DeleteConversationDataset]. +message DeleteConversationDatasetOperationMetadata { + +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_event.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_event.proto new file mode 100644 index 00000000000..6c45e895f14 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_event.proto @@ -0,0 +1,85 @@ +// Copyright 2022 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"; + +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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_model.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_model.proto new file mode 100644 index 00000000000..065290df5f0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_model.proto @@ -0,0 +1,653 @@ +// Copyright 2022 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/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 = "ConversationModelProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Manages a collection of models for human agent assistant. +service ConversationModels { + 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 model. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [CreateConversationModelOperationMetadata][google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata] + // - `response`: [ConversationModel][google.cloud.dialogflow.v2.ConversationModel] + rpc CreateConversationModel(CreateConversationModelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/conversationModels" + body: "conversation_model" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/conversationModels" + body: "conversation_model" + } + }; + option (google.api.method_signature) = "parent,conversation_model"; + option (google.longrunning.operation_info) = { + response_type: "ConversationModel" + metadata_type: "CreateConversationModelOperationMetadata" + }; + } + + // Gets conversation model. + rpc GetConversationModel(GetConversationModelRequest) returns (ConversationModel) { + option (google.api.http) = { + get: "/v2/{name=projects/*/conversationModels/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/conversationModels/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Lists conversation models. + rpc ListConversationModels(ListConversationModelsRequest) returns (ListConversationModelsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/conversationModels" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*}/conversationModels" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes a model. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [DeleteConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata] + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + rpc DeleteConversationModel(DeleteConversationModelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/conversationModels/*}" + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/conversationModels/*}" + } + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "DeleteConversationModelOperationMetadata" + }; + } + + // Deploys a model. If a model is already deployed, deploying it + // has no effect. A model can only serve prediction requests after it gets + // deployed. For article suggestion, custom model will not be used unless + // it is deployed. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [DeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata] + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + rpc DeployConversationModel(DeployConversationModelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/conversationModels/*}:deploy" + body: "*" + additional_bindings { + post: "/v2/{name=projects/*/locations/*/conversationModels/*}:deploy" + body: "*" + } + }; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "DeployConversationModelOperationMetadata" + }; + } + + // Undeploys a model. If the model is not deployed this method has no effect. + // If the model is currently being used: + // - For article suggestion, article suggestion will fallback to the default + // model if model is undeployed. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [UndeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata] + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + rpc UndeployConversationModel(UndeployConversationModelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/conversationModels/*}:undeploy" + body: "*" + additional_bindings { + post: "/v2/{name=projects/*/locations/*/conversationModels/*}:undeploy" + body: "*" + } + }; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "UndeployConversationModelOperationMetadata" + }; + } + + // Gets an evaluation of conversation model. + rpc GetConversationModelEvaluation(GetConversationModelEvaluationRequest) returns (ConversationModelEvaluation) { + option (google.api.http) = { + get: "/v2/{name=projects/*/conversationModels/*/evaluations/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/conversationModels/*/evaluations/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Lists evaluations of a conversation model. + rpc ListConversationModelEvaluations(ListConversationModelEvaluationsRequest) returns (ListConversationModelEvaluationsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/conversationModels/*}/evaluations" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/conversationModels/*}/evaluations" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Creates evaluation of a conversation model. + rpc CreateConversationModelEvaluation(CreateConversationModelEvaluationRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*/conversationModels/*}/evaluations" + body: "*" + }; + option (google.api.method_signature) = "parent,conversation_model_evaluation"; + option (google.longrunning.operation_info) = { + response_type: "ConversationModelEvaluation" + metadata_type: "CreateConversationModelEvaluationOperationMetadata" + }; + } +} + +// Represents a conversation model. +message ConversationModel { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/ConversationModel" + pattern: "projects/{project}/locations/{location}/conversationModels/{conversation_model}" + pattern: "projects/{project}/conversationModels/{conversation_model}" + }; + + // State of the model. + enum State { + // Should not be used, an un-set enum has this value by default. + STATE_UNSPECIFIED = 0; + + // Model being created. + CREATING = 1; + + // Model is not deployed but ready to deploy. + UNDEPLOYED = 2; + + // Model is deploying. + DEPLOYING = 3; + + // Model is deployed and ready to use. + DEPLOYED = 4; + + // Model is undeploying. + UNDEPLOYING = 5; + + // Model is deleting. + DELETING = 6; + + // Model is in error state. Not ready to deploy and use. + FAILED = 7; + + // Model is being created but the training has not started, + // The model may remain in this state until there is enough capacity to + // start training. + PENDING = 8; + } + + // Model type. + enum ModelType { + // ModelType unspecified. + MODEL_TYPE_UNSPECIFIED = 0; + + // ModelType smart reply dual encoder model. + SMART_REPLY_DUAL_ENCODER_MODEL = 2; + + // ModelType smart reply bert model. + SMART_REPLY_BERT_MODEL = 6; + } + + // ConversationModel resource name. Format: + // `projects//conversationModels/` + string name = 1; + + // Required. The display name of the model. At most 64 bytes long. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Creation time of this model. + google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Datasets used to create model. + repeated InputDataset datasets = 4 [(google.api.field_behavior) = REQUIRED]; + + // Output only. State of the model. A model can only serve prediction requests + // after it gets deployed. + State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Language code for the conversation model. If not specified, the language + // is en-US. Language at ConversationModel should be set for all non en-us + // languages. + // This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + // language tag. Example: "en-US". + string language_code = 19; + + // Required. + // The model metadata that is specific to the problem type. + // Must match the metadata type of the dataset used to train the model. + oneof model_metadata { + // Metadata for article suggestion models. + ArticleSuggestionModelMetadata article_suggestion_model_metadata = 8; + + // Metadata for smart reply models. + SmartReplyModelMetadata smart_reply_model_metadata = 9; + } +} + +// Represents evaluation result of a conversation model. +message ConversationModelEvaluation { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/ConversationModelEvaluation" + pattern: "projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}" + pattern: "projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}" + }; + + // The resource name of the evaluation. Format: + // `projects//conversationModels//evaluations/` + string name = 1; + + // Optional. The display name of the model evaluation. At most 64 bytes long. + string display_name = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The configuration of the evaluation task. + EvaluationConfig evaluation_config = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Creation time of this model. + google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Metrics details. + oneof metrics { + // Output only. Only available when model is for smart reply. + SmartReplyMetrics smart_reply_metrics = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + } +} + +// The configuration for model evaluation. +message EvaluationConfig { + // Smart reply specific configuration for evaluation job. + message SmartReplyConfig { + // The allowlist document resource name. + // Format: `projects//knowledgeBases//documents/`. Only used for smart reply model. + string allowlist_document = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + }]; + + // Required. The model to be evaluated can return multiple results with confidence + // score on each query. These results will be sorted by the descending order + // of the scores and we only keep the first max_result_count results as the + // final results to evaluate. + int32 max_result_count = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // Smart compose specific configuration for evaluation job. + message SmartComposeConfig { + // The allowlist document resource name. + // Format: `projects//knowledgeBases//documents/`. Only used for smart compose model. + string allowlist_document = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + }]; + + // Required. The model to be evaluated can return multiple results with confidence + // score on each query. These results will be sorted by the descending order + // of the scores and we only keep the first max_result_count results as the + // final results to evaluate. + int32 max_result_count = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // Required. Datasets used for evaluation. + repeated InputDataset datasets = 3 [(google.api.field_behavior) = REQUIRED]; + + // Specific configurations for different models in order to do evaluation. + oneof model_specific_config { + // Configuration for smart reply model evalution. + SmartReplyConfig smart_reply_config = 2; + + // Configuration for smart compose model evalution. + SmartComposeConfig smart_compose_config = 4; + } +} + +// InputDataset used to create model or do evaluation. +// NextID:5 +message InputDataset { + // Required. ConversationDataset resource name. Format: + // `projects//locations//conversationDatasets/` + string dataset = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationDataset" + } + ]; +} + +// Metadata for article suggestion models. +message ArticleSuggestionModelMetadata { + // Optional. Type of the article suggestion model. If not provided, model_type is used. + ConversationModel.ModelType training_model_type = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Metadata for smart reply models. +message SmartReplyModelMetadata { + // Optional. Type of the smart reply model. If not provided, model_type is used. + ConversationModel.ModelType training_model_type = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// The evaluation metrics for smart reply model. +message SmartReplyMetrics { + // Evaluation metrics when retrieving `n` smart replies with the model. + message TopNMetrics { + // Number of retrieved smart replies. For example, when `n` is 3, this + // evaluation contains metrics for when Dialogflow retrieves 3 smart replies + // with the model. + int32 n = 1; + + // Defined as `number of queries whose top n smart replies have at least one + // similar (token match similarity above the defined threshold) reply as the + // real reply` divided by `number of queries with at least one smart reply`. + // Value ranges from 0.0 to 1.0 inclusive. + float recall = 2; + } + + // Percentage of target participant messages in the evaluation dataset for + // which similar messages have appeared at least once in the allowlist. Should + // be [0, 1]. + float allowlist_coverage = 1; + + // Metrics of top n smart replies, sorted by [TopNMetric.n][]. + repeated TopNMetrics top_n_metrics = 2; + + // Total number of conversations used to generate this metric. + int64 conversation_count = 3; +} + +// The request message for +// [ConversationModels.CreateConversationModel][google.cloud.dialogflow.v2.ConversationModels.CreateConversationModel] +message CreateConversationModelRequest { + // The project to create conversation model for. Format: + // `projects/` + string parent = 1; + + // Required. The conversation model to create. + ConversationModel conversation_model = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for +// [ConversationModels.GetConversationModel][google.cloud.dialogflow.v2.ConversationModels.GetConversationModel] +message GetConversationModelRequest { + // Required. The conversation model to retrieve. Format: + // `projects//conversationModels/` + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for +// [ConversationModels.ListConversationModels][google.cloud.dialogflow.v2.ConversationModels.ListConversationModels] +message ListConversationModelsRequest { + // Required. The project to list all conversation models for. + // Format: `projects/` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Maximum number of conversation models 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 +// [ConversationModels.ListConversationModels][google.cloud.dialogflow.v2.ConversationModels.ListConversationModels] +message ListConversationModelsResponse { + // The list of models to return. + repeated ConversationModel conversation_models = 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 +// [ConversationModels.DeleteConversationModel][google.cloud.dialogflow.v2.ConversationModels.DeleteConversationModel] +message DeleteConversationModelRequest { + // Required. The conversation model to delete. Format: + // `projects//conversationModels/` + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for +// [ConversationModels.DeployConversationModel][google.cloud.dialogflow.v2.ConversationModels.DeployConversationModel] +message DeployConversationModelRequest { + // Required. The conversation model to deploy. Format: + // `projects//conversationModels/` + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for +// [ConversationModels.UndeployConversationModel][google.cloud.dialogflow.v2.ConversationModels.UndeployConversationModel] +message UndeployConversationModelRequest { + // Required. The conversation model to undeploy. Format: + // `projects//conversationModels/` + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for +// [ConversationModels.GetConversationModelEvaluation][google.cloud.dialogflow.v2.ConversationModels.GetConversationModelEvaluation] +message GetConversationModelEvaluationRequest { + // Required. The conversation model evaluation resource name. Format: + // `projects//conversationModels//evaluations/` + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for +// [ConversationModels.ListConversationModelEvaluations][google.cloud.dialogflow.v2.ConversationModels.ListConversationModelEvaluations] +message ListConversationModelEvaluationsRequest { + // Required. The conversation model resource name. Format: + // `projects//conversationModels/` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Maximum number of evaluations 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 +// [ConversationModels.ListConversationModelEvaluations][google.cloud.dialogflow.v2.ConversationModels.ListConversationModelEvaluations] +message ListConversationModelEvaluationsResponse { + // The list of evaluations to return. + repeated ConversationModelEvaluation conversation_model_evaluations = 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 +// [ConversationModels.CreateConversationModelEvaluation][google.cloud.dialogflow.v2.ConversationModels.CreateConversationModelEvaluation] +message CreateConversationModelEvaluationRequest { + // Required. The conversation model resource name. Format: + // `projects//locations//conversationModels/` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/ConversationModelEvaluation" + } + ]; + + // Required. The conversation model evaluation to be created. + ConversationModelEvaluation conversation_model_evaluation = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Metadata for a [ConversationModels.CreateConversationModel][google.cloud.dialogflow.v2.ConversationModels.CreateConversationModel] operation. +message CreateConversationModelOperationMetadata { + // State of CreateConversationModel operation. + enum State { + // Invalid. + STATE_UNSPECIFIED = 0; + + // Request is submitted, but training has not started yet. + // The model may remain in this state until there is enough capacity to + // start training. + PENDING = 1; + + // The training has succeeded. + SUCCEEDED = 2; + + // The training has succeeded. + FAILED = 3; + + // The training has been cancelled. + CANCELLED = 4; + + // The training is in cancelling state. + CANCELLING = 5; + + // Custom model is training. + TRAINING = 6; + } + + // The resource name of the conversation model. Format: + // `projects//conversationModels/` + string conversation_model = 1; + + // State of CreateConversationModel operation. + State state = 2; + + // Timestamp when the request to create conversation model is submitted. The + // time is measured on server side. + google.protobuf.Timestamp create_time = 3; +} + +// Metadata for a [ConversationModels.DeployConversationModel][google.cloud.dialogflow.v2.ConversationModels.DeployConversationModel] operation. +message DeployConversationModelOperationMetadata { + // The resource name of the conversation model. Format: + // `projects//conversationModels/` + string conversation_model = 1; + + // Timestamp when request to deploy conversation model was submitted. The time + // is measured on server side. + google.protobuf.Timestamp create_time = 3; +} + +// Metadata for a [ConversationModels.UndeployConversationModel][google.cloud.dialogflow.v2.ConversationModels.UndeployConversationModel] operation. +message UndeployConversationModelOperationMetadata { + // The resource name of the conversation model. Format: + // `projects//conversationModels/` + string conversation_model = 1; + + // Timestamp when the request to undeploy conversation model was submitted. + // The time is measured on server side. + google.protobuf.Timestamp create_time = 3; +} + +// Metadata for a [ConversationModels.DeleteConversationModel][google.cloud.dialogflow.v2.ConversationModels.DeleteConversationModel] operation. +message DeleteConversationModelOperationMetadata { + // The resource name of the conversation model. Format: + // `projects//conversationModels/` + string conversation_model = 1; + + // Timestamp when delete conversation model request was created. The time is + // measured on server side. + google.protobuf.Timestamp create_time = 3; +} + +// Metadata for a +// [ConversationModels.CreateConversationModelEvaluation][google.cloud.dialogflow.v2.ConversationModels.CreateConversationModelEvaluation] +// operation. +message CreateConversationModelEvaluationOperationMetadata { + // State of CreateConversationModel operation. + enum State { + // Operation status not specified. + STATE_UNSPECIFIED = 0; + + // The operation is being prepared. + INITIALIZING = 1; + + // The operation is running. + RUNNING = 2; + + // The operation is cancelled. + CANCELLED = 3; + + // The operation has succeeded. + SUCCEEDED = 4; + + // The operation has failed. + FAILED = 5; + } + + // The resource name of the conversation model. Format: + // `projects//locations//conversationModels//evaluations/` + string conversation_model_evaluation = 1; + + // The resource name of the conversation model. Format: + // `projects//locations//conversationModels/` + string conversation_model = 4; + + // State of CreateConversationModel operation. + State state = 2; + + // Timestamp when the request to create conversation model was submitted. The + // time is measured on server side. + google.protobuf.Timestamp create_time = 3; +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_profile.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_profile.proto new file mode 100644 index 00000000000..d1a33bb8025 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_profile.proto @@ -0,0 +1,753 @@ +// Copyright 2022 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}" +}; + +// 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"; + } + + // Adds or updates a suggestion feature in a conversation profile. + // If the conversation profile contains the type of suggestion feature for + // the participant role, it will update it. Otherwise it will insert the + // suggestion feature. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [SetSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata] + // - `response`: [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile] + // + // If a long running operation to add or update suggestion feature + // config for the same conversation profile, participant role and suggestion + // feature type exists, please cancel the existing long running operation + // before sending such request, otherwise the request will be rejected. + rpc SetSuggestionFeatureConfig(SetSuggestionFeatureConfigRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{conversation_profile=projects/*/conversationProfiles/*}:setSuggestionFeatureConfig" + body: "*" + additional_bindings { + post: "/v2/{conversation_profile=projects/*/locations/*/conversationProfiles/*}:setSuggestionFeatureConfig" + body: "*" + } + }; + option (google.api.method_signature) = "conversation_profile"; + option (google.longrunning.operation_info) = { + response_type: "ConversationProfile" + metadata_type: "SetSuggestionFeatureConfigOperationMetadata" + }; + } + + // Clears a suggestion feature from a conversation profile for the given + // participant role. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [ClearSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata] + // - `response`: [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile] + rpc ClearSuggestionFeatureConfig(ClearSuggestionFeatureConfigRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{conversation_profile=projects/*/conversationProfiles/*}:clearSuggestionFeatureConfig" + body: "*" + additional_bindings { + post: "/v2/{conversation_profile=projects/*/locations/*/conversationProfiles/*}:clearSuggestionFeatureConfig" + body: "*" + } + }; + option (google.api.method_signature) = "conversation_profile"; + option (google.longrunning.operation_info) = { + response_type: "ConversationProfile" + metadata_type: "ClearSuggestionFeatureConfigOperationMetadata" + }; + } +} + +// 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 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. + // This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + // language tag. Example: "en-US". + string language_code = 10; + + // The time zone of this conversational profile from the + // [time zone database](https://www.iana.org/time-zones), e.g., + // America/New_York, Europe/Paris. Defaults to America/New_York. + string time_zone = 14; + + // Name of the CX SecuritySettings reference for the agent. + // Format: `projects//locations//securitySettings/`. + string security_settings = 13 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/CXSecuritySettings" + }]; +} + +// 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. + // + // - 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.v2#google.cloud.dialogflow.v2.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 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; + + // Configs for processing conversation. + ConversationProcessConfig conversation_process_config = 8; + } + + // 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, 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, + // CONVERSATION_SUMMARIZATION. + message ConversationModelConfig { + // Conversation model resource name. Format: `projects//conversationModels/`. + string model = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationModel" + }]; + } + + // Config to process conversation. + message ConversationProcessConfig { + // Number of recent non-small-talk sentences to use as context for article + // and FAQ suggestion + int32 recent_sentences_count = 2; + } + + // 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 unspecified, PROTO will be used. + MESSAGE_FORMAT_UNSPECIFIED = 0; + + // Pub/Sub message will be serialized proto. + PROTO = 1; + + // Pub/Sub 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. + // + // For telephony integration to receive notification, make sure either this + // topic 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. + // + // For chat integration to receive notification, make sure API caller has been + // granted the `Dialogflow Service Agent` role for the topic. + // + // 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 for chat. + ARTICLE_SUGGESTION = 1; + + // Run FAQ model for chat. + FAQ = 2; + + // Run smart reply model for chat. + SMART_REPLY = 3; + } + + // Type of Human Agent Assistant API feature to request. + Type type = 1; +} + +// The request message for +// [ConversationProfiles.SetSuggestionFeature][]. +message SetSuggestionFeatureConfigRequest { + // Required. The Conversation Profile to add or update the suggestion feature + // config. Format: `projects//locations//conversationProfiles/`. + string conversation_profile = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The participant role to add or update the suggestion feature + // config. Only HUMAN_AGENT or END_USER can be used. + Participant.Role participant_role = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The suggestion feature config to add or update. + HumanAgentAssistantConfig.SuggestionFeatureConfig suggestion_feature_config = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [ConversationProfiles.ClearFeature][]. +message ClearSuggestionFeatureConfigRequest { + // Required. The Conversation Profile to add or update the suggestion feature + // config. Format: `projects//locations//conversationProfiles/`. + string conversation_profile = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The participant role to remove the suggestion feature + // config. Only HUMAN_AGENT or END_USER can be used. + Participant.Role participant_role = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The type of the suggestion feature to remove. + SuggestionFeature.Type suggestion_feature_type = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Metadata for a [ConversationProfile.SetSuggestionFeatureConfig][] +// operation. +message SetSuggestionFeatureConfigOperationMetadata { + // The resource name of the conversation profile. Format: + // `projects//locations//conversationProfiles/` + string conversation_profile = 1; + + // Required. The participant role to add or update the suggestion feature + // config. Only HUMAN_AGENT or END_USER can be used. + Participant.Role participant_role = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The type of the suggestion feature to add or update. + SuggestionFeature.Type suggestion_feature_type = 3 [(google.api.field_behavior) = REQUIRED]; + + // Timestamp whe the request was created. The time is measured on server side. + google.protobuf.Timestamp create_time = 4; +} + +// Metadata for a [ConversationProfile.ClearSuggestionFeatureConfig][] +// operation. +message ClearSuggestionFeatureConfigOperationMetadata { + // The resource name of the conversation profile. Format: + // `projects//locations//conversationProfiles/` + string conversation_profile = 1; + + // Required. The participant role to remove the suggestion feature + // config. Only HUMAN_AGENT or END_USER can be used. + Participant.Role participant_role = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The type of the suggestion feature to remove. + SuggestionFeature.Type suggestion_feature_type = 3 [(google.api.field_behavior) = REQUIRED]; + + // Timestamp whe the request was created. The time is measured on server side. + google.protobuf.Timestamp create_time = 4; +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/document.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/document.proto new file mode 100644 index 00000000000..1241621948f --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/document.proto @@ -0,0 +1,636 @@ +// Copyright 2022 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/gcs.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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] + // - `response`: [Document][google.cloud.dialogflow.v2.Document] + 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" + }; + } + + // Creates 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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] + // - `response`: [ImportDocumentsResponse][google.cloud.dialogflow.v2.ImportDocumentsResponse] + rpc ImportDocuments(ImportDocumentsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/knowledgeBases/*}/documents:import" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/knowledgeBases/*}/documents:import" + body: "*" + } + }; + option (google.longrunning.operation_info) = { + response_type: "ImportDocumentsResponse" + metadata_type: "KnowledgeOperationMetadata" + }; + } + + // Deletes the specified document. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + 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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] + // - `response`: [Document][google.cloud.dialogflow.v2.Document] + 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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] + // - `response`: [Document][google.cloud.dialogflow.v2.Document] + // + // 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: "/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" + }; + } + + // Exports a smart messaging candidate document into the specified + // destination. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] + // - `response`: [Document][google.cloud.dialogflow.v2.Document] + rpc ExportDocument(ExportDocumentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/knowledgeBases/*/documents/*}:export" + body: "*" + additional_bindings { + post: "/v2/{name=projects/*/locations/*/knowledgeBases/*/documents/*}:export" + body: "*" + } + }; + 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 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 document contains agent-facing Smart Reply entries. + AGENT_FACING_SMART_REPLY = 4; + } + + // 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; + } + + // Possible states of the document + enum State { + // The document state is unspecified. + STATE_UNSPECIFIED = 0; + + // The document creation is in progress. + CREATING = 1; + + // The document is active and ready to use. + ACTIVE = 2; + + // The document updation is in progress. + UPDATING = 3; + + // The document is reloading. + RELOADING = 4; + + // The document deletion is in progress. + DELETING = 5; + } + + // 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]; + + // Output only. The current state of the document. + State state = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// 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; + + // 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.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.ImportDocuments][google.cloud.dialogflow.v2.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.v2.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.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]; + } + + // Optional. 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 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. When enabled, the reload request is to apply partial update to the smart + // messaging allowlist. + bool smart_messaging_partial_update = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [Documents.ExportDocument][google.cloud.dialogflow.v2.Documents.ExportDocument]. +message ExportDocumentRequest { + // Required. The name of the document to export. + // Format: `projects//locations//knowledgeBases//documents/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + } + ]; + + // Required. The destination for the export. + oneof destination { + // Cloud Storage file path to export the document. + GcsDestination gcs_destination = 2; + } + + // When enabled, export the full content of the document including empirical + // probability. + bool export_full_content = 3; + + // When enabled, export the smart messaging allowlist document for partial + // update. + bool smart_messaging_partial_update = 5; +} + +// Metadata related to the Export Data Operations (e.g. ExportDocument). +message ExportOperationMetadata { + // Cloud Storage file path of the exported data. + GcsDestination exported_gcs_destination = 1; +} + +// 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]; + + // The name of the knowledge base interacted with during the operation. + string knowledge_base = 3; + + // Additional metadata for the Knowledge operation. + oneof operation_metadata { + // Metadata for the Export Data Operation such as the destination of export. + ExportOperationMetadata export_operation_metadata = 4; + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/entity_type.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/entity_type.proto new file mode 100644 index 00000000000..acb5b94f25e --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/entity_type.proto @@ -0,0 +1,613 @@ +// Copyright 2022 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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: [BatchUpdateEntityTypesResponse][google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse] + // + // 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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // 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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // 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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // 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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // 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}" + }; + + // 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; + } + + // 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]; + } + + // 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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/environment.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/environment.proto new file mode 100644 index 00000000000..f368db3ec84 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/environment.proto @@ -0,0 +1,390 @@ +// Copyright 2022 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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/fulfillment.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/fulfillment.proto new file mode 100644 index 00000000000..b1103fe41c0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/fulfillment.proto @@ -0,0 +1,177 @@ +// Copyright 2022 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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/gcs.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/gcs.proto new file mode 100644 index 00000000000..6ac9886df90 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/gcs.proto @@ -0,0 +1,45 @@ +// Copyright 2022 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"; + +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"; + +// Google Cloud Storage location 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 the output. +message GcsDestination { + // The Google Cloud Storage URIs for the output. A URI is of the + // form: + // gs://bucket/object-prefix-or-name + // Whether a prefix or name is used depends on the use case. The requesting + // user must have "write-permission" to the bucket. + string uri = 1; +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto new file mode 100644 index 00000000000..0bae8f6834e --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto @@ -0,0 +1,43 @@ +// Copyright 2022 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"; + +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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/intent.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/intent.proto new file mode 100644 index 00000000000..e28e0d312a3 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/intent.proto @@ -0,0 +1,1111 @@ +// Copyright 2022 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/context.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "IntentProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// 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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2.BatchUpdateIntentsResponse] + // + // 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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // 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 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; + } + + // Represents an example that the agent is trained on. + message TrainingPhrase { + // 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]; + } + + // 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]; + } + + // 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 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; + } + + // 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 { + // Format of response media type. + enum ResponseMediaType { + // Unspecified. + RESPONSE_MEDIA_TYPE_UNSPECIFIED = 0; + + // Response media type is audio. + AUDIO = 1; + } + + // 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; + } + + // 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; + } + + // 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; + } + + // 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]; + + // Output only. + // 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 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // 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; + + // Output only. 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 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// 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]; +} + +// 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; +} + +// This message is a wrapper around a collection of intents. +message IntentBatch { + // A collection of intents. + repeated Intent intents = 1; +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/knowledge_base.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/knowledge_base.proto new file mode 100644 index 00000000000..4f047e2ecde --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/knowledge_base.proto @@ -0,0 +1,262 @@ +// Copyright 2022 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; + + // 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.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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/participant.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/participant.proto new file mode 100644 index 00000000000..a39d49fb527 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/participant.proto @@ -0,0 +1,1000 @@ +// Copyright 2022 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/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"; + } + + // Adds a text (chat, for example), or audio (phone recording, for example) + // message from a participant into the conversation. + // Note: This method is only available through the gRPC API (not REST). + // + // The top-level message sent to the client by the server is + // `StreamingAnalyzeContentResponse`. Multiple response messages can be + // returned in order. The first one or more messages contain the + // `recognition_result` field. Each result represents a more complete + // transcript of what the user said. The next message contains the + // `reply_text` field and potentially the `reply_audio` field. The message can + // also contain the `automated_agent_reply` field. + // + // 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 StreamingAnalyzeContent(stream StreamingAnalyzeContentRequest) returns (stream StreamingAnalyzeContentResponse) { + } + + // 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"; + } + + // Gets smart replies for a participant based on specific historical + // messages. + rpc SuggestSmartReplies(SuggestSmartRepliesRequest) returns (SuggestSmartRepliesResponse) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestSmartReplies" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestSmartReplies" + 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]; + + // 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.v2.CreateParticipantRequest.participant] or + // [UpdateParticipantRequest][google.cloud.dialogflow.v2.UpdateParticipantRequest.participant], + // Dialogflow adds the obfuscated user id with the participant. + // + // 2. If you set this field in + // [AnalyzeContent][google.cloud.dialogflow.v2.AnalyzeContentRequest.obfuscated_external_user_id] or + // [StreamingAnalyzeContent][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.obfuscated_external_user_id], + // Dialogflow will update [Participant.obfuscated_external_user_id][google.cloud.dialogflow.v2.Participant.obfuscated_external_user_id]. + // + // Dialogflow returns an error if you try to add a user id for a + // non-[END_USER][google.cloud.dialogflow.v2.Participant.Role.END_USER] participant. + // + // Dialogflow uses this user id for billing and measurement purposes. For + // example, Dialogflow determines whether a user in one conversation returned + // in a later conversation. + // + // 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]; + + // Optional. Key-value filters on the metadata of documents returned by article + // suggestion. If specified, article suggestion only returns suggested + // documents that match all filters in their [Document.metadata][google.cloud.dialogflow.v2.Document.metadata]. Multiple + // values for a metadata key should be concatenated by comma. For example, + // filters to match all documents that have 'US' or 'CA' in their market + // metadata values and 'agent' in their user metadata values will be + // ``` + // documents_metadata_filters { + // key: "market" + // value: "US,CA" + // } + // documents_metadata_filters { + // key: "user" + // value: "agent" + // } + // ``` + map documents_metadata_filters = 8 [(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.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; + + // Parameters for a human assist query. + AssistQueryParameters assist_query_params = 14; + + // Additional parameters to be put into Dialogflow CX session parameters. To + // remove a parameter from the session, clients should explicitly set the + // parameter value to null. + // + // Note: this field should only be used if you are connecting to a Dialogflow + // CX agent. + google.protobuf.Struct cx_parameters = 18; + + // 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]. + // + // Note that any failure of Agent Assist features will not lead to the overall + // failure of an AnalyzeContent API call. Instead, the features will + // fail silently with the error field set in the corresponding + // SuggestionResult. + 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]. + // + // Same as human_agent_suggestion_results, any failure of Agent Assist + // features will not lead to the overall failure of an AnalyzeContent API + // call. Instead, the features will fail silently with the error field set in + // the corresponding SuggestionResult. + repeated SuggestionResult end_user_suggestion_results = 7; + + // Indicates the parameters of DTMF. + DtmfParameters dtmf_parameters = 9; +} + +// The top-level message sent by the client to the +// [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent] method. +// +// Multiple request messages should be sent in order: +// +// 1. The first message must contain +// [participant][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.participant], +// [config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.config] and optionally +// [query_params][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.query_params]. If you want +// to receive an audio response, it should also contain +// [reply_audio_config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.reply_audio_config]. +// The message must not contain +// [input][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.input]. +// +// 2. If [config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.config] in the first message +// was set to [audio_config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.audio_config], +// all subsequent messages must contain +// [input_audio][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.input_audio] to continue +// with Speech recognition. +// However, note that: +// +// * Dialogflow will bill you for the audio so far. +// * Dialogflow discards all Speech recognition results in favor of the +// text input. +// +// 3. If [StreamingAnalyzeContentRequest.config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.config] in the first message was set +// to [StreamingAnalyzeContentRequest.text_config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.text_config], then the second message +// must contain only [input_text][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.input_text]. +// Moreover, you must not send more than two messages. +// +// After you sent all input, you must half-close or abort the request stream. +message StreamingAnalyzeContentRequest { + // 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" + } + ]; + + // The input config. + oneof config { + // Instructs the speech recognizer how to process the speech audio. + InputAudioConfig audio_config = 2; + + // The natural language text to be processed. + InputTextConfig text_config = 3; + } + + // 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 + // StreamingAnalyzeContent. If this configuration is not supplied, speech + // synthesis is disabled. + OutputAudioConfig reply_audio_config = 4; + + // The input. + oneof input { + // The input audio content to be recognized. Must be sent if `audio_config` + // is set in the first message. The complete audio over all streaming + // messages must not exceed 1 minute. + bytes input_audio = 5; + + // The UTF-8 encoded natural language text to be processed. Must be sent if + // `text_config` is set in the first message. Text length must not exceed + // 256 bytes for virtual agent interactions. The `input_text` field can be + // only sent once. + string input_text = 6; + + // The DTMF digits used to invoke intent and fill in parameter value. + // + // This input is ignored if the previous response indicated that DTMF input + // is not accepted. + TelephonyDtmfEvents input_dtmf = 9; + } + + // Parameters for a Dialogflow virtual-agent query. + QueryParameters query_params = 7; + + // Parameters for a human assist query. + AssistQueryParameters assist_query_params = 8; + + // Additional parameters to be put into Dialogflow CX session parameters. To + // remove a parameter from the session, clients should explicitly set the + // parameter value to null. + // + // Note: this field should only be used if you are connecting to a Dialogflow + // CX agent. + google.protobuf.Struct cx_parameters = 13; + + // Enable partial virtual agent responses. If this flag is not enabled, + // response stream still contains only one final response even if some + // `Fulfillment`s in Dialogflow virtual agent have been configured to return + // partial responses. + bool enable_partial_automated_agent_reply = 12; +} + +// The top-level message returned from the `StreamingAnalyzeContent` 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. In virtual agent stage: if `enable_partial_automated_agent_reply` is +// true, the following N (currently 1 <= N <= 4) messages +// contain `automated_agent_reply` and optionally `reply_audio` +// returned by the virtual agent. The first (N-1) +// `automated_agent_reply`s will have `automated_agent_reply_type` set to +// `PARTIAL`. The last `automated_agent_reply` has +// `automated_agent_reply_type` set to `FINAL`. +// If `enable_partial_automated_agent_reply` is not enabled, response stream +// only contains the final reply. +// +// In human assist stage: the following N (N >= 1) messages contain +// `human_agent_suggestion_results`, `end_user_suggestion_results` or +// `message`. +message StreamingAnalyzeContentResponse { + // The result of speech recognition. + StreamingRecognitionResult recognition_result = 1; + + // The output text content. + // This field is set if an automated agent responded with a text for the user. + string reply_text = 2; + + // The audio data bytes encoded as specified in the request. + // This field is set if: + // + // - The `reply_audio_config` field is specified in the request. + // - The automated agent, which this output comes from, responded with audio. + // In such case, the `reply_audio.config` field 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 = 3; + + // 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.StreamingAnalyzeContentResponse.reply_audio] instead. + AutomatedAgentReply automated_agent_reply = 4; + + // Message analyzed by CCAI. + Message message = 6; + + // 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 = 7; + + // 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 = 8; + + // Indicates the parameters of DTMF. + DtmfParameters dtmf_parameters = 10; +} + +// 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" + } + ]; + + // 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.v2.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]; + + // Parameters for a human assist query. + AssistQueryParameters assist_query_params = 4; +} + +// 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" + } + ]; + + // 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]; + + // Parameters for a human assist query. + AssistQueryParameters assist_query_params = 4; +} + +// 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; +} + +// The request message for [Participants.SuggestSmartReplies][google.cloud.dialogflow.v2.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" + }]; + + // 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.v2.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 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The name of the latest conversation message used to compile + // suggestion for. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Message" + }]; + + // Number of messages prior to and including + // [latest_message][google.cloud.dialogflow.v2.SuggestSmartRepliesResponse.latest_message] to compile the + // suggestion. It may be smaller than the + // [SuggestSmartRepliesRequest.context_size][google.cloud.dialogflow.v2.SuggestSmartRepliesRequest.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; +} + +// 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 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/AnswerRecord" + }]; +} + +// 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; + + // SuggestSmartRepliesResponse if request is for SMART_REPLY. + SuggestSmartRepliesResponse suggest_smart_replies_response = 4; + } +} + +// Defines the language used in the input text. +message InputTextConfig { + // 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. + string language_code = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// 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; +} + +// Represents the parameters of human assist query. +message AssistQueryParameters { + // Key-value filters on the metadata of documents returned by article + // suggestion. If specified, article suggestion only returns suggested + // documents that match all filters in their [Document.metadata][google.cloud.dialogflow.v2.Document.metadata]. Multiple + // values for a metadata key should be concatenated by comma. For example, + // filters to match all documents that have 'US' or 'CA' in their market + // metadata values and 'agent' in their user metadata values will be + // ``` + // documents_metadata_filters { + // key: "market" + // value: "US,CA" + // } + // documents_metadata_filters { + // key: "user" + // value: "agent" + // } + // ``` + map documents_metadata_filters = 1; +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/session.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/session.proto new file mode 100644 index 00000000000..107e02060a3 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/session.proto @@ -0,0 +1,701 @@ +// Copyright 2022 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. + // + // If you might use + // [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) + // or other CCAI products now or in the future, consider using + // [AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] + // instead of `DetectIntent`. `AnalyzeContent` has additional + // functionality for Agent Assist and other CCAI products. + // + // 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). + // + // If you might use + // [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) + // or other CCAI products now or in the future, consider using + // [StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent] + // instead of `StreamingDetectIntent`. `StreamingAnalyzeContent` has + // additional functionality for Agent Assist and other CCAI products. + // + // 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. Text length must not exceed + // 256 character for virtual agent interactions. + 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. For more information, see the [cancel slot filling + // documentation](https://cloud.google.com/dialogflow/es/docs/intents-actions-parameters#cancel). + 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 `StreamingDetectIntentRequest.input_audio` field was +// set, the `recognition_result` field is populated for one +// or more messages. +// See the [StreamingRecognitionResult][google.cloud.dialogflow.v2.StreamingRecognitionResult] message for details +// about the result message sequence. +// +// 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. +// +// While end-user audio is being processed, Dialogflow sends a series of +// results. Each result may contain a `transcript` value. A transcript +// represents a portion of the utterance. While the recognizer is processing +// audio, transcript values may be interim values or finalized values. +// Once a transcript is finalized, the `is_final` value is set to true and +// processing continues for the next transcript. +// +// If `StreamingDetectIntentRequest.query_input.audio_config.single_utterance` +// was true, and the recognizer has completed processing audio, +// the `message_type` value is set to `END_OF_SINGLE_UTTERANCE and the +// following (last) result contains the last finalized transcript. +// +// The complete end-user utterance is determined by concatenating the +// finalized transcript values received for the series of results. +// +// In the following example, single utterance is enabled. In the case where +// single utterance is not enabled, result 7 would not occur. +// +// ``` +// Num | transcript | message_type | is_final +// --- | ----------------------- | ----------------------- | -------- +// 1 | "tube" | TRANSCRIPT | false +// 2 | "to be a" | TRANSCRIPT | false +// 3 | "to be" | TRANSCRIPT | false +// 4 | "to be or not to be" | TRANSCRIPT | true +// 5 | "that's" | TRANSCRIPT | false +// 6 | "that is | TRANSCRIPT | false +// 7 | unset | END_OF_SINGLE_UTTERANCE | unset +// 8 | " that is the question" | TRANSCRIPT | true +// ``` +// +// Concatenating the finalized transcripts with `is_final` set to true, +// the complete utterance becomes "to be or not to be that is the question". +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; +} + +// ============================================================================ +// Auxiliary proto messages. +// +// 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 for virtual agent interactions. + 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. + // + // This field is ignored when used in the context of a + // [WebhookResponse.followup_event_input][google.cloud.dialogflow.v2.WebhookResponse.followup_event_input] field, + // because the language was already defined in the originating detect + // intent request. + 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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/session_entity_type.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/session_entity_type.proto new file mode 100644 index 00000000000..00cceba1cc5 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/session_entity_type.proto @@ -0,0 +1,313 @@ +// Copyright 2022 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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/validation_result.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/validation_result.proto new file mode 100644 index 00000000000..a4c77a9993f --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/validation_result.proto @@ -0,0 +1,74 @@ +// Copyright 2022 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; + +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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/version.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/version.proto new file mode 100644 index 00000000000..8244c547bd7 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/version.proto @@ -0,0 +1,267 @@ +// Copyright 2022 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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/webhook.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/webhook.proto new file mode 100644 index 00000000000..a672ff7150c --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/webhook.proto @@ -0,0 +1,144 @@ +// Copyright 2022 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"; + +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/google-cloud-dialogflow/v2/samples/generated/v2/agents.delete_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.delete_agent.js new file mode 100644 index 00000000000..35a1a41ca4b --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.delete_agent.js @@ -0,0 +1,62 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_Agents_DeleteAgent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent to delete is associated with. + * Format: `projects/`. + */ + // const parent = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callDeleteAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.deleteAgent(request); + console.log(response); + } + + callDeleteAgent(); + // [END dialogflow_v2_generated_Agents_DeleteAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.export_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.export_agent.js new file mode 100644 index 00000000000..576b77437fe --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.export_agent.js @@ -0,0 +1,76 @@ +// Copyright 2022 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'; + +function main(parent, agentUri) { + // [START dialogflow_v2_generated_Agents_ExportAgent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent to export is associated with. + * Format: `projects/`. + */ + // const parent = 'abc123' + /** + * 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. + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * Dialogflow access + * control (https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + */ + // const agentUri = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callExportAgent() { + // Construct request + const request = { + parent, + agentUri, + }; + + // Run request + const [operation] = await dialogflowClient.exportAgent(request); + const [response] = await operation.promise(); + console.log(response); + } + + callExportAgent(); + // [END dialogflow_v2_generated_Agents_ExportAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.get_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.get_agent.js new file mode 100644 index 00000000000..273222deed8 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.get_agent.js @@ -0,0 +1,62 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_Agents_GetAgent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent to fetch is associated with. + * Format: `projects/`. + */ + // const parent = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callGetAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.getAgent(request); + console.log(response); + } + + callGetAgent(); + // [END dialogflow_v2_generated_Agents_GetAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.get_validation_result.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.get_validation_result.js new file mode 100644 index 00000000000..c5ac6dbc83a --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.get_validation_result.js @@ -0,0 +1,70 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_Agents_GetValidationResult_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent is associated with. + * Format: `projects/`. + */ + // const parent = 'abc123' + /** + * 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. + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callGetValidationResult() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.getValidationResult(request); + console.log(response); + } + + callGetValidationResult(); + // [END dialogflow_v2_generated_Agents_GetValidationResult_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.import_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.import_agent.js new file mode 100644 index 00000000000..336d133cfd2 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.import_agent.js @@ -0,0 +1,77 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_Agents_ImportAgent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent to import is associated with. + * Format: `projects/`. + */ + // const parent = 'abc123' + /** + * The URI to a Google Cloud Storage file containing the agent to import. + * Note: The URI must start with "gs://". + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * Dialogflow access + * control (https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + */ + // const agentUri = 'abc123' + /** + * Zip compressed raw byte content for agent. + */ + // const agentContent = 'Buffer.from('string')' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callImportAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.importAgent(request); + const [response] = await operation.promise(); + console.log(response); + } + + callImportAgent(); + // [END dialogflow_v2_generated_Agents_ImportAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.restore_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.restore_agent.js new file mode 100644 index 00000000000..02954f41349 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.restore_agent.js @@ -0,0 +1,77 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_Agents_RestoreAgent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent to restore is associated with. + * Format: `projects/`. + */ + // const parent = 'abc123' + /** + * The URI to a Google Cloud Storage file containing the agent to restore. + * Note: The URI must start with "gs://". + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * Dialogflow access + * control (https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + */ + // const agentUri = 'abc123' + /** + * Zip compressed raw byte content for agent. + */ + // const agentContent = 'Buffer.from('string')' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callRestoreAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.restoreAgent(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRestoreAgent(); + // [END dialogflow_v2_generated_Agents_RestoreAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.search_agents.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.search_agents.js new file mode 100644 index 00000000000..1daeb2188f6 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.search_agents.js @@ -0,0 +1,73 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_Agents_SearchAgents_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to list agents from. + * Format: `projects/`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callSearchAgents() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.searchAgentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callSearchAgents(); + // [END dialogflow_v2_generated_Agents_SearchAgents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.set_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.set_agent.js new file mode 100644 index 00000000000..369c74e522d --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.set_agent.js @@ -0,0 +1,65 @@ +// Copyright 2022 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'; + +function main(agent) { + // [START dialogflow_v2_generated_Agents_SetAgent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to update. + */ + // const agent = {} + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callSetAgent() { + // Construct request + const request = { + agent, + }; + + // Run request + const response = await dialogflowClient.setAgent(request); + console.log(response); + } + + callSetAgent(); + // [END dialogflow_v2_generated_Agents_SetAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.train_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.train_agent.js new file mode 100644 index 00000000000..ebf5cd5d62d --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.train_agent.js @@ -0,0 +1,63 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_Agents_TrainAgent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent to train is associated with. + * Format: `projects/`. + */ + // const parent = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callTrainAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.trainAgent(request); + const [response] = await operation.promise(); + console.log(response); + } + + callTrainAgent(); + // [END dialogflow_v2_generated_Agents_TrainAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/answer_records.list_answer_records.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/answer_records.list_answer_records.js new file mode 100644 index 00000000000..fa4bab0a98a --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/answer_records.list_answer_records.js @@ -0,0 +1,85 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_AnswerRecords_ListAnswerRecords_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to list all answer records for in reverse + * chronological order. Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Optional. Filters to restrict results to specific answer records. + * Marked deprecated as it hasn't been, and isn't currently, supported. + * For more information about filtering, see + * API Filtering (https://aip.dev/160). + */ + // const filter = 'abc123' + /** + * 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. + */ + // const pageSize = 1234 + /** + * 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. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {AnswerRecordsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AnswerRecordsClient(); + + async function callListAnswerRecords() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listAnswerRecordsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAnswerRecords(); + // [END dialogflow_v2_generated_AnswerRecords_ListAnswerRecords_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/answer_records.update_answer_record.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/answer_records.update_answer_record.js new file mode 100644 index 00000000000..4108c84266d --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/answer_records.update_answer_record.js @@ -0,0 +1,66 @@ +// Copyright 2022 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'; + +function main(answerRecord, updateMask) { + // [START dialogflow_v2_generated_AnswerRecords_UpdateAnswerRecord_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Answer record to update. + */ + // const answerRecord = {} + /** + * Required. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {AnswerRecordsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AnswerRecordsClient(); + + async function callUpdateAnswerRecord() { + // Construct request + const request = { + answerRecord, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateAnswerRecord(request); + console.log(response); + } + + callUpdateAnswerRecord(); + // [END dialogflow_v2_generated_AnswerRecords_UpdateAnswerRecord_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.create_context.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.create_context.js new file mode 100644 index 00000000000..13cdb444a00 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.create_context.js @@ -0,0 +1,71 @@ +// Copyright 2022 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'; + +function main(parent, context) { + // [START dialogflow_v2_generated_Contexts_CreateContext_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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. + */ + // const parent = 'abc123' + /** + * Required. The context to create. + */ + // const context = {} + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function callCreateContext() { + // Construct request + const request = { + parent, + context, + }; + + // Run request + const response = await dialogflowClient.createContext(request); + console.log(response); + } + + callCreateContext(); + // [END dialogflow_v2_generated_Contexts_CreateContext_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.delete_all_contexts.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.delete_all_contexts.js new file mode 100644 index 00000000000..4bbb7d03111 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.delete_all_contexts.js @@ -0,0 +1,66 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_Contexts_DeleteAllContexts_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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. + */ + // const parent = 'abc123' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function callDeleteAllContexts() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.deleteAllContexts(request); + console.log(response); + } + + callDeleteAllContexts(); + // [END dialogflow_v2_generated_Contexts_DeleteAllContexts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.delete_context.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.delete_context.js new file mode 100644 index 00000000000..24aca4681ba --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.delete_context.js @@ -0,0 +1,66 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_Contexts_DeleteContext_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function callDeleteContext() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteContext(request); + console.log(response); + } + + callDeleteContext(); + // [END dialogflow_v2_generated_Contexts_DeleteContext_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.get_context.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.get_context.js new file mode 100644 index 00000000000..717f9ec1aee --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.get_context.js @@ -0,0 +1,66 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_Contexts_GetContext_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function callGetContext() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getContext(request); + console.log(response); + } + + callGetContext(); + // [END dialogflow_v2_generated_Contexts_GetContext_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.list_contexts.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.list_contexts.js new file mode 100644 index 00000000000..cc5b18618ef --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.list_contexts.js @@ -0,0 +1,77 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_Contexts_ListContexts_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function callListContexts() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listContextsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListContexts(); + // [END dialogflow_v2_generated_Contexts_ListContexts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.update_context.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.update_context.js new file mode 100644 index 00000000000..2cfc4668522 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.update_context.js @@ -0,0 +1,65 @@ +// Copyright 2022 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'; + +function main(context) { + // [START dialogflow_v2_generated_Contexts_UpdateContext_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The context to update. + */ + // const context = {} + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function callUpdateContext() { + // Construct request + const request = { + context, + }; + + // Run request + const response = await dialogflowClient.updateContext(request); + console.log(response); + } + + callUpdateContext(); + // [END dialogflow_v2_generated_Contexts_UpdateContext_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.create_conversation_dataset.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.create_conversation_dataset.js new file mode 100644 index 00000000000..eb2c98d3877 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.create_conversation_dataset.js @@ -0,0 +1,68 @@ +// Copyright 2022 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'; + +function main(parent, conversationDataset) { + // [START dialogflow_v2_generated_ConversationDatasets_CreateConversationDataset_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to create conversation dataset for. Format: + * `projects//locations/` + */ + // const parent = 'abc123' + /** + * Required. The conversation dataset to create. + */ + // const conversationDataset = {} + + // Imports the Dialogflow library + const {ConversationDatasetsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationDatasetsClient(); + + async function callCreateConversationDataset() { + // Construct request + const request = { + parent, + conversationDataset, + }; + + // Run request + const [operation] = await dialogflowClient.createConversationDataset(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateConversationDataset(); + // [END dialogflow_v2_generated_ConversationDatasets_CreateConversationDataset_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.delete_conversation_dataset.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.delete_conversation_dataset.js new file mode 100644 index 00000000000..3c20de247e8 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.delete_conversation_dataset.js @@ -0,0 +1,64 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_ConversationDatasets_DeleteConversationDataset_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The conversation dataset to delete. Format: + * `projects//locations//conversationDatasets/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationDatasetsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationDatasetsClient(); + + async function callDeleteConversationDataset() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await dialogflowClient.deleteConversationDataset(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteConversationDataset(); + // [END dialogflow_v2_generated_ConversationDatasets_DeleteConversationDataset_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.get_conversation_dataset.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.get_conversation_dataset.js new file mode 100644 index 00000000000..44c6c78537c --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.get_conversation_dataset.js @@ -0,0 +1,63 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_ConversationDatasets_GetConversationDataset_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The conversation dataset to retrieve. Format: + * `projects//locations//conversationDatasets/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationDatasetsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationDatasetsClient(); + + async function callGetConversationDataset() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getConversationDataset(request); + console.log(response); + } + + callGetConversationDataset(); + // [END dialogflow_v2_generated_ConversationDatasets_GetConversationDataset_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.import_conversation_data.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.import_conversation_data.js new file mode 100644 index 00000000000..6f75c4fa269 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.import_conversation_data.js @@ -0,0 +1,69 @@ +// Copyright 2022 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'; + +function main(name, inputConfig) { + // [START dialogflow_v2_generated_ConversationDatasets_ImportConversationData_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Dataset resource name. Format: + * `projects//locations//conversationDatasets/` + */ + // const name = 'abc123' + /** + * Required. Configuration describing where to import data from. + */ + // const inputConfig = {} + + // Imports the Dialogflow library + const {ConversationDatasetsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationDatasetsClient(); + + async function callImportConversationData() { + // Construct request + const request = { + name, + inputConfig, + }; + + // Run request + const [operation] = await dialogflowClient.importConversationData(request); + const [response] = await operation.promise(); + console.log(response); + } + + callImportConversationData(); + // [END dialogflow_v2_generated_ConversationDatasets_ImportConversationData_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.list_conversation_datasets.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.list_conversation_datasets.js new file mode 100644 index 00000000000..aad091cdac7 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.list_conversation_datasets.js @@ -0,0 +1,73 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_ConversationDatasets_ListConversationDatasets_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project and location name to list all conversation datasets for. + * Format: `projects//locations/` + */ + // const parent = 'abc123' + /** + * Optional. Maximum number of conversation datasets to return in a single + * page. By default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ConversationDatasetsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationDatasetsClient(); + + async function callListConversationDatasets() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listConversationDatasetsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListConversationDatasets(); + // [END dialogflow_v2_generated_ConversationDatasets_ListConversationDatasets_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.create_conversation_model.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.create_conversation_model.js new file mode 100644 index 00000000000..d4b354f244b --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.create_conversation_model.js @@ -0,0 +1,67 @@ +// Copyright 2022 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'; + +function main(conversationModel) { + // [START dialogflow_v2_generated_ConversationModels_CreateConversationModel_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The project to create conversation model for. Format: + * `projects/` + */ + // const parent = 'abc123' + /** + * Required. The conversation model to create. + */ + // const conversationModel = {} + + // Imports the Dialogflow library + const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationModelsClient(); + + async function callCreateConversationModel() { + // Construct request + const request = { + conversationModel, + }; + + // Run request + const [operation] = await dialogflowClient.createConversationModel(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateConversationModel(); + // [END dialogflow_v2_generated_ConversationModels_CreateConversationModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.create_conversation_model_evaluation.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.create_conversation_model_evaluation.js new file mode 100644 index 00000000000..b535f38f5d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.create_conversation_model_evaluation.js @@ -0,0 +1,69 @@ +// Copyright 2022 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'; + +function main(parent, conversationModelEvaluation) { + // [START dialogflow_v2_generated_ConversationModels_CreateConversationModelEvaluation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The conversation model resource name. Format: + * `projects//locations//conversationModels/` + */ + // const parent = 'abc123' + /** + * Required. The conversation model evaluation to be created. + */ + // const conversationModelEvaluation = {} + + // Imports the Dialogflow library + const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationModelsClient(); + + async function callCreateConversationModelEvaluation() { + // Construct request + const request = { + parent, + conversationModelEvaluation, + }; + + // Run request + const [operation] = await dialogflowClient.createConversationModelEvaluation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateConversationModelEvaluation(); + // [END dialogflow_v2_generated_ConversationModels_CreateConversationModelEvaluation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.delete_conversation_model.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.delete_conversation_model.js new file mode 100644 index 00000000000..c444a87c1d3 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.delete_conversation_model.js @@ -0,0 +1,63 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_ConversationModels_DeleteConversationModel_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The conversation model to delete. Format: + * `projects//conversationModels/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationModelsClient(); + + async function callDeleteConversationModel() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await dialogflowClient.deleteConversationModel(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteConversationModel(); + // [END dialogflow_v2_generated_ConversationModels_DeleteConversationModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.deploy_conversation_model.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.deploy_conversation_model.js new file mode 100644 index 00000000000..8e9de89b3e6 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.deploy_conversation_model.js @@ -0,0 +1,63 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_ConversationModels_DeployConversationModel_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The conversation model to deploy. Format: + * `projects//conversationModels/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationModelsClient(); + + async function callDeployConversationModel() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await dialogflowClient.deployConversationModel(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeployConversationModel(); + // [END dialogflow_v2_generated_ConversationModels_DeployConversationModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.get_conversation_model.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.get_conversation_model.js new file mode 100644 index 00000000000..ad2f4924465 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.get_conversation_model.js @@ -0,0 +1,62 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_ConversationModels_GetConversationModel_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The conversation model to retrieve. Format: + * `projects//conversationModels/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationModelsClient(); + + async function callGetConversationModel() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getConversationModel(request); + console.log(response); + } + + callGetConversationModel(); + // [END dialogflow_v2_generated_ConversationModels_GetConversationModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.get_conversation_model_evaluation.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.get_conversation_model_evaluation.js new file mode 100644 index 00000000000..c8181e4053d --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.get_conversation_model_evaluation.js @@ -0,0 +1,63 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_ConversationModels_GetConversationModelEvaluation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The conversation model evaluation resource name. Format: + * `projects//conversationModels//evaluations/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationModelsClient(); + + async function callGetConversationModelEvaluation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getConversationModelEvaluation(request); + console.log(response); + } + + callGetConversationModelEvaluation(); + // [END dialogflow_v2_generated_ConversationModels_GetConversationModelEvaluation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.list_conversation_model_evaluations.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.list_conversation_model_evaluations.js new file mode 100644 index 00000000000..6d550c7ef1b --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.list_conversation_model_evaluations.js @@ -0,0 +1,73 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_ConversationModels_ListConversationModelEvaluations_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The conversation model resource name. Format: + * `projects//conversationModels/` + */ + // const parent = 'abc123' + /** + * Optional. Maximum number of evaluations to return in a + * single page. By default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationModelsClient(); + + async function callListConversationModelEvaluations() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listConversationModelEvaluationsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListConversationModelEvaluations(); + // [END dialogflow_v2_generated_ConversationModels_ListConversationModelEvaluations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.list_conversation_models.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.list_conversation_models.js new file mode 100644 index 00000000000..b930d994328 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.list_conversation_models.js @@ -0,0 +1,73 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_ConversationModels_ListConversationModels_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to list all conversation models for. + * Format: `projects/` + */ + // const parent = 'abc123' + /** + * Optional. Maximum number of conversation models to return in a single + * page. By default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationModelsClient(); + + async function callListConversationModels() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listConversationModelsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListConversationModels(); + // [END dialogflow_v2_generated_ConversationModels_ListConversationModels_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.undeploy_conversation_model.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.undeploy_conversation_model.js new file mode 100644 index 00000000000..4b604037364 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.undeploy_conversation_model.js @@ -0,0 +1,63 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_ConversationModels_UndeployConversationModel_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The conversation model to undeploy. Format: + * `projects//conversationModels/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationModelsClient(); + + async function callUndeployConversationModel() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await dialogflowClient.undeployConversationModel(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUndeployConversationModel(); + // [END dialogflow_v2_generated_ConversationModels_UndeployConversationModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.clear_suggestion_feature_config.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.clear_suggestion_feature_config.js new file mode 100644 index 00000000000..1f96e6101ce --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.clear_suggestion_feature_config.js @@ -0,0 +1,75 @@ +// Copyright 2022 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'; + +function main(conversationProfile, participantRole, suggestionFeatureType) { + // [START dialogflow_v2_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The Conversation Profile to add or update the suggestion feature + * config. Format: `projects//locations//conversationProfiles/`. + */ + // const conversationProfile = 'abc123' + /** + * Required. The participant role to remove the suggestion feature + * config. Only HUMAN_AGENT or END_USER can be used. + */ + // const participantRole = {} + /** + * Required. The type of the suggestion feature to remove. + */ + // const suggestionFeatureType = {} + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callClearSuggestionFeatureConfig() { + // Construct request + const request = { + conversationProfile, + participantRole, + suggestionFeatureType, + }; + + // Run request + const [operation] = await dialogflowClient.clearSuggestionFeatureConfig(request); + const [response] = await operation.promise(); + console.log(response); + } + + callClearSuggestionFeatureConfig(); + // [END dialogflow_v2_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.create_conversation_profile.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.create_conversation_profile.js new file mode 100644 index 00000000000..06c37b6fd9e --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.create_conversation_profile.js @@ -0,0 +1,67 @@ +// Copyright 2022 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'; + +function main(parent, conversationProfile) { + // [START dialogflow_v2_generated_ConversationProfiles_CreateConversationProfile_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to create a conversation profile for. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Required. The conversation profile to create. + */ + // const conversationProfile = {} + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callCreateConversationProfile() { + // Construct request + const request = { + parent, + conversationProfile, + }; + + // Run request + const response = await dialogflowClient.createConversationProfile(request); + console.log(response); + } + + callCreateConversationProfile(); + // [END dialogflow_v2_generated_ConversationProfiles_CreateConversationProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.delete_conversation_profile.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.delete_conversation_profile.js new file mode 100644 index 00000000000..4dca2d27888 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.delete_conversation_profile.js @@ -0,0 +1,63 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_ConversationProfiles_DeleteConversationProfile_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the conversation profile to delete. + * Format: `projects//locations//conversationProfiles/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callDeleteConversationProfile() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteConversationProfile(request); + console.log(response); + } + + callDeleteConversationProfile(); + // [END dialogflow_v2_generated_ConversationProfiles_DeleteConversationProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.get_conversation_profile.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.get_conversation_profile.js new file mode 100644 index 00000000000..e4cd2c91e96 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.get_conversation_profile.js @@ -0,0 +1,63 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_ConversationProfiles_GetConversationProfile_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the conversation profile. + * Format: `projects//locations//conversationProfiles/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callGetConversationProfile() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getConversationProfile(request); + console.log(response); + } + + callGetConversationProfile(); + // [END dialogflow_v2_generated_ConversationProfiles_GetConversationProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.list_conversation_profiles.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.list_conversation_profiles.js new file mode 100644 index 00000000000..a25e61e3fc8 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.list_conversation_profiles.js @@ -0,0 +1,73 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_ConversationProfiles_ListConversationProfiles_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to list all conversation profiles from. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callListConversationProfiles() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listConversationProfilesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListConversationProfiles(); + // [END dialogflow_v2_generated_ConversationProfiles_ListConversationProfiles_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.set_suggestion_feature_config.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.set_suggestion_feature_config.js new file mode 100644 index 00000000000..767750ae2ff --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.set_suggestion_feature_config.js @@ -0,0 +1,75 @@ +// Copyright 2022 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'; + +function main(conversationProfile, participantRole, suggestionFeatureConfig) { + // [START dialogflow_v2_generated_ConversationProfiles_SetSuggestionFeatureConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The Conversation Profile to add or update the suggestion feature + * config. Format: `projects//locations//conversationProfiles/`. + */ + // const conversationProfile = 'abc123' + /** + * Required. The participant role to add or update the suggestion feature + * config. Only HUMAN_AGENT or END_USER can be used. + */ + // const participantRole = {} + /** + * Required. The suggestion feature config to add or update. + */ + // const suggestionFeatureConfig = {} + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callSetSuggestionFeatureConfig() { + // Construct request + const request = { + conversationProfile, + participantRole, + suggestionFeatureConfig, + }; + + // Run request + const [operation] = await dialogflowClient.setSuggestionFeatureConfig(request); + const [response] = await operation.promise(); + console.log(response); + } + + callSetSuggestionFeatureConfig(); + // [END dialogflow_v2_generated_ConversationProfiles_SetSuggestionFeatureConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.update_conversation_profile.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.update_conversation_profile.js new file mode 100644 index 00000000000..1a6a41ab264 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.update_conversation_profile.js @@ -0,0 +1,66 @@ +// Copyright 2022 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'; + +function main(conversationProfile, updateMask) { + // [START dialogflow_v2_generated_ConversationProfiles_UpdateConversationProfile_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The conversation profile to update. + */ + // const conversationProfile = {} + /** + * Required. The mask to control which fields to update. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callUpdateConversationProfile() { + // Construct request + const request = { + conversationProfile, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateConversationProfile(request); + console.log(response); + } + + callUpdateConversationProfile(); + // [END dialogflow_v2_generated_ConversationProfiles_UpdateConversationProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.complete_conversation.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.complete_conversation.js new file mode 100644 index 00000000000..a1f2f129c46 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.complete_conversation.js @@ -0,0 +1,63 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_Conversations_CompleteConversation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource identifier of the conversation to close. + * Format: `projects//locations//conversations/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callCompleteConversation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.completeConversation(request); + console.log(response); + } + + callCompleteConversation(); + // [END dialogflow_v2_generated_Conversations_CompleteConversation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.create_conversation.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.create_conversation.js new file mode 100644 index 00000000000..390d99d9131 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.create_conversation.js @@ -0,0 +1,79 @@ +// Copyright 2022 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'; + +function main(parent, conversation) { + // [START dialogflow_v2_generated_Conversations_CreateConversation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource identifier of the project creating the conversation. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Required. The conversation to create. + */ + // const conversation = {} + /** + * 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. + */ + // const conversationId = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callCreateConversation() { + // Construct request + const request = { + parent, + conversation, + }; + + // Run request + const response = await dialogflowClient.createConversation(request); + console.log(response); + } + + callCreateConversation(); + // [END dialogflow_v2_generated_Conversations_CreateConversation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.get_conversation.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.get_conversation.js new file mode 100644 index 00000000000..a75dbd80632 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.get_conversation.js @@ -0,0 +1,63 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_Conversations_GetConversation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the conversation. Format: + * `projects//locations//conversations/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callGetConversation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getConversation(request); + console.log(response); + } + + callGetConversation(); + // [END dialogflow_v2_generated_Conversations_GetConversation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.list_conversations.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.list_conversations.js new file mode 100644 index 00000000000..23328a9beb7 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.list_conversations.js @@ -0,0 +1,91 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_Conversations_ListConversations_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project from which to list all conversation. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + /** + * 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). + */ + // const filter = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callListConversations() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listConversationsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListConversations(); + // [END dialogflow_v2_generated_Conversations_ListConversations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.list_messages.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.list_messages.js new file mode 100644 index 00000000000..dc87405de1f --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.list_messages.js @@ -0,0 +1,84 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_Conversations_ListMessages_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the conversation to list messages for. + * Format: `projects//locations//conversations/` + */ + // const parent = 'abc123' + /** + * 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). + */ + // const filter = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callListMessages() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listMessagesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListMessages(); + // [END dialogflow_v2_generated_Conversations_ListMessages_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.create_document.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.create_document.js new file mode 100644 index 00000000000..7a59f4c0126 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.create_document.js @@ -0,0 +1,69 @@ +// Copyright 2022 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'; + +function main(parent, document) { + // [START dialogflow_v2_generated_Documents_CreateDocument_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The knowledge base to create a document for. + * Format: `projects//locations//knowledgeBases/`. + */ + // const parent = 'abc123' + /** + * Required. The document to create. + */ + // const document = {} + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callCreateDocument() { + // Construct request + const request = { + parent, + document, + }; + + // Run request + const [operation] = await dialogflowClient.createDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateDocument(); + // [END dialogflow_v2_generated_Documents_CreateDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.delete_document.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.delete_document.js new file mode 100644 index 00000000000..962a21c8e37 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.delete_document.js @@ -0,0 +1,64 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_Documents_DeleteDocument_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the document to delete. + * Format: `projects//locations//knowledgeBases//documents/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callDeleteDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await dialogflowClient.deleteDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteDocument(); + // [END dialogflow_v2_generated_Documents_DeleteDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.export_document.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.export_document.js new file mode 100644 index 00000000000..cae64ba4f17 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.export_document.js @@ -0,0 +1,78 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_Documents_ExportDocument_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the document to export. + * Format: `projects//locations//knowledgeBases//documents/`. + */ + // const name = 'abc123' + /** + * Cloud Storage file path to export the document. + */ + // const gcsDestination = {} + /** + * When enabled, export the full content of the document including empirical + * probability. + */ + // const exportFullContent = true + /** + * When enabled, export the smart messaging allowlist document for partial + * update. + */ + // const smartMessagingPartialUpdate = true + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callExportDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await dialogflowClient.exportDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + callExportDocument(); + // [END dialogflow_v2_generated_Documents_ExportDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.get_document.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.get_document.js new file mode 100644 index 00000000000..9fce9ffc540 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.get_document.js @@ -0,0 +1,63 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_Documents_GetDocument_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the document to retrieve. + * Format `projects//locations//knowledgeBases//documents/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callGetDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getDocument(request); + console.log(response); + } + + callGetDocument(); + // [END dialogflow_v2_generated_Documents_GetDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.import_documents.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.import_documents.js new file mode 100644 index 00000000000..7861311d1ec --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.import_documents.js @@ -0,0 +1,82 @@ +// Copyright 2022 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'; + +function main(parent, documentTemplate) { + // [START dialogflow_v2_generated_Documents_ImportDocuments_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The knowledge base to import documents into. + * Format: `projects//locations//knowledgeBases/`. + */ + // const parent = 'abc123' + /** + * The Google Cloud Storage location for the documents. + * The path can include a wildcard. + * These URIs may have the forms + * `gs:///`. + * `gs:////*.`. + */ + // const gcsSource = {} + /** + * Required. Document template used for importing all the documents. + */ + // const documentTemplate = {} + /** + * Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + */ + // const importGcsCustomMetadata = true + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callImportDocuments() { + // Construct request + const request = { + parent, + documentTemplate, + }; + + // Run request + const [operation] = await dialogflowClient.importDocuments(request); + const [response] = await operation.promise(); + console.log(response); + } + + callImportDocuments(); + // [END dialogflow_v2_generated_Documents_ImportDocuments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.list_documents.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.list_documents.js new file mode 100644 index 00000000000..795b3ea3439 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.list_documents.js @@ -0,0 +1,92 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_Documents_ListDocuments_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The knowledge base to list all documents for. + * Format: `projects//locations//knowledgeBases/`. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return in a single page. By + * default 10 and at most 100. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + /** + * 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). + */ + // const filter = 'abc123' + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callListDocuments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listDocumentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListDocuments(); + // [END dialogflow_v2_generated_Documents_ListDocuments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.reload_document.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.reload_document.js new file mode 100644 index 00000000000..c5b6c1b9745 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.reload_document.js @@ -0,0 +1,81 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_Documents_ReloadDocument_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the document to reload. + * Format: `projects//locations//knowledgeBases//documents/` + */ + // const name = 'abc123' + /** + * 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:///`. + */ + // const contentUri = 'abc123' + /** + * Optional. Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + */ + // const importGcsCustomMetadata = true + /** + * Optional. When enabled, the reload request is to apply partial update to the smart + * messaging allowlist. + */ + // const smartMessagingPartialUpdate = true + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callReloadDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await dialogflowClient.reloadDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + callReloadDocument(); + // [END dialogflow_v2_generated_Documents_ReloadDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.update_document.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.update_document.js new file mode 100644 index 00000000000..56f44cd204f --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.update_document.js @@ -0,0 +1,68 @@ +// Copyright 2022 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'; + +function main(document) { + // [START dialogflow_v2_generated_Documents_UpdateDocument_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The document to update. + */ + // const document = {} + /** + * Optional. Not specified means `update all`. + * Currently, only `display_name` can be updated, an InvalidArgument will be + * returned for attempting to update other fields. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callUpdateDocument() { + // Construct request + const request = { + document, + }; + + // Run request + const [operation] = await dialogflowClient.updateDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateDocument(); + // [END dialogflow_v2_generated_Documents_UpdateDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_create_entities.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_create_entities.js new file mode 100644 index 00000000000..0af48b2d653 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_create_entities.js @@ -0,0 +1,76 @@ +// Copyright 2022 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'; + +function main(parent, entities) { + // [START dialogflow_v2_generated_EntityTypes_BatchCreateEntities_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the entity type to create entities in. Format: + * `projects//agent/entityTypes/`. + */ + // const parent = 'abc123' + /** + * Required. The entities to create. + */ + // const entities = 1234 + /** + * 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). + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callBatchCreateEntities() { + // Construct request + const request = { + parent, + entities, + }; + + // Run request + const [operation] = await dialogflowClient.batchCreateEntities(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchCreateEntities(); + // [END dialogflow_v2_generated_EntityTypes_BatchCreateEntities_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_delete_entities.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_delete_entities.js new file mode 100644 index 00000000000..f84f2922bfa --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_delete_entities.js @@ -0,0 +1,78 @@ +// Copyright 2022 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'; + +function main(parent, entityValues) { + // [START dialogflow_v2_generated_EntityTypes_BatchDeleteEntities_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the entity type to delete entries for. Format: + * `projects//agent/entityTypes/`. + */ + // const parent = 'abc123' + /** + * 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/`. + */ + // const entityValues = 'abc123' + /** + * 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). + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callBatchDeleteEntities() { + // Construct request + const request = { + parent, + entityValues, + }; + + // Run request + const [operation] = await dialogflowClient.batchDeleteEntities(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchDeleteEntities(); + // [END dialogflow_v2_generated_EntityTypes_BatchDeleteEntities_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_delete_entity_types.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_delete_entity_types.js new file mode 100644 index 00000000000..1b1e6839e6b --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_delete_entity_types.js @@ -0,0 +1,69 @@ +// Copyright 2022 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'; + +function main(parent, entityTypeNames) { + // [START dialogflow_v2_generated_EntityTypes_BatchDeleteEntityTypes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the agent to delete all entities types for. Format: + * `projects//agent`. + */ + // const parent = 'abc123' + /** + * Required. The names entity types to delete. All names must point to the + * same agent as `parent`. + */ + // const entityTypeNames = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callBatchDeleteEntityTypes() { + // Construct request + const request = { + parent, + entityTypeNames, + }; + + // Run request + const [operation] = await dialogflowClient.batchDeleteEntityTypes(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchDeleteEntityTypes(); + // [END dialogflow_v2_generated_EntityTypes_BatchDeleteEntityTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_update_entities.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_update_entities.js new file mode 100644 index 00000000000..6b914ec3043 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_update_entities.js @@ -0,0 +1,80 @@ +// Copyright 2022 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'; + +function main(parent, entities) { + // [START dialogflow_v2_generated_EntityTypes_BatchUpdateEntities_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the entity type to update or create entities in. + * Format: `projects//agent/entityTypes/`. + */ + // const parent = 'abc123' + /** + * Required. The entities to update or create. + */ + // const entities = 1234 + /** + * 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). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callBatchUpdateEntities() { + // Construct request + const request = { + parent, + entities, + }; + + // Run request + const [operation] = await dialogflowClient.batchUpdateEntities(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchUpdateEntities(); + // [END dialogflow_v2_generated_EntityTypes_BatchUpdateEntities_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_update_entity_types.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_update_entity_types.js new file mode 100644 index 00000000000..c2a1ed41d4b --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_update_entity_types.js @@ -0,0 +1,86 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_EntityTypes_BatchUpdateEntityTypes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the agent to update or create entity types in. + * Format: `projects//agent`. + */ + // const parent = 'abc123' + /** + * 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://". + */ + // const entityTypeBatchUri = 'abc123' + /** + * The collection of entity types to update or create. + */ + // const entityTypeBatchInline = {} + /** + * 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). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callBatchUpdateEntityTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.batchUpdateEntityTypes(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchUpdateEntityTypes(); + // [END dialogflow_v2_generated_EntityTypes_BatchUpdateEntityTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.create_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.create_entity_type.js new file mode 100644 index 00000000000..45bca5bf77f --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.create_entity_type.js @@ -0,0 +1,75 @@ +// Copyright 2022 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'; + +function main(parent, entityType) { + // [START dialogflow_v2_generated_EntityTypes_CreateEntityType_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to create a entity type for. + * Format: `projects//agent`. + */ + // const parent = 'abc123' + /** + * Required. The entity type to create. + */ + // const 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). + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callCreateEntityType() { + // Construct request + const request = { + parent, + entityType, + }; + + // Run request + const response = await dialogflowClient.createEntityType(request); + console.log(response); + } + + callCreateEntityType(); + // [END dialogflow_v2_generated_EntityTypes_CreateEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.delete_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.delete_entity_type.js new file mode 100644 index 00000000000..03c20e526bb --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.delete_entity_type.js @@ -0,0 +1,62 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_EntityTypes_DeleteEntityType_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the entity type to delete. + * Format: `projects//agent/entityTypes/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callDeleteEntityType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteEntityType(request); + console.log(response); + } + + callDeleteEntityType(); + // [END dialogflow_v2_generated_EntityTypes_DeleteEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.get_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.get_entity_type.js new file mode 100644 index 00000000000..9ce87aff18a --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.get_entity_type.js @@ -0,0 +1,70 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_EntityTypes_GetEntityType_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the entity type. + * Format: `projects//agent/entityTypes/`. + */ + // const name = 'abc123' + /** + * 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). + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callGetEntityType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getEntityType(request); + console.log(response); + } + + callGetEntityType(); + // [END dialogflow_v2_generated_EntityTypes_GetEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.list_entity_types.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.list_entity_types.js new file mode 100644 index 00000000000..e5d3abb8854 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.list_entity_types.js @@ -0,0 +1,81 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_EntityTypes_ListEntityTypes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to list all entity types from. + * Format: `projects//agent`. + */ + // const parent = 'abc123' + /** + * 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). + */ + // const languageCode = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callListEntityTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listEntityTypesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListEntityTypes(); + // [END dialogflow_v2_generated_EntityTypes_ListEntityTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.update_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.update_entity_type.js new file mode 100644 index 00000000000..9522c7521f6 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.update_entity_type.js @@ -0,0 +1,73 @@ +// Copyright 2022 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'; + +function main(entityType) { + // [START dialogflow_v2_generated_EntityTypes_UpdateEntityType_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The entity type to update. + */ + // const 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). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callUpdateEntityType() { + // Construct request + const request = { + entityType, + }; + + // Run request + const response = await dialogflowClient.updateEntityType(request); + console.log(response); + } + + callUpdateEntityType(); + // [END dialogflow_v2_generated_EntityTypes_UpdateEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.create_environment.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.create_environment.js new file mode 100644 index 00000000000..0139e135542 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.create_environment.js @@ -0,0 +1,74 @@ +// Copyright 2022 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'; + +function main(parent, environment, environmentId) { + // [START dialogflow_v2_generated_Environments_CreateEnvironment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to create an environment for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Required. The environment to create. + */ + // const environment = {} + /** + * Required. The unique id of the new environment. + */ + // const environmentId = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function callCreateEnvironment() { + // Construct request + const request = { + parent, + environment, + environmentId, + }; + + // Run request + const response = await dialogflowClient.createEnvironment(request); + console.log(response); + } + + callCreateEnvironment(); + // [END dialogflow_v2_generated_Environments_CreateEnvironment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.delete_environment.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.delete_environment.js new file mode 100644 index 00000000000..a13c799a0a5 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.delete_environment.js @@ -0,0 +1,66 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_Environments_DeleteEnvironment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the environment to delete. + * / Format: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * The environment ID for the default environment is `-`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function callDeleteEnvironment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteEnvironment(request); + console.log(response); + } + + callDeleteEnvironment(); + // [END dialogflow_v2_generated_Environments_DeleteEnvironment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.get_environment.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.get_environment.js new file mode 100644 index 00000000000..f1dd9fbe7c1 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.get_environment.js @@ -0,0 +1,66 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_Environments_GetEnvironment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the environment. + * Supported formats: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * The environment ID for the default environment is `-`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function callGetEnvironment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getEnvironment(request); + console.log(response); + } + + callGetEnvironment(); + // [END dialogflow_v2_generated_Environments_GetEnvironment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.get_environment_history.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.get_environment_history.js new file mode 100644 index 00000000000..7efbf8c312c --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.get_environment_history.js @@ -0,0 +1,77 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_Environments_GetEnvironmentHistory_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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 `-`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function callGetEnvironmentHistory() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.getEnvironmentHistoryAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callGetEnvironmentHistory(); + // [END dialogflow_v2_generated_Environments_GetEnvironmentHistory_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.list_environments.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.list_environments.js new file mode 100644 index 00000000000..232d265b7c5 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.list_environments.js @@ -0,0 +1,75 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_Environments_ListEnvironments_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to list all environments from. + * Format: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function callListEnvironments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listEnvironmentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListEnvironments(); + // [END dialogflow_v2_generated_Environments_ListEnvironments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.update_environment.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.update_environment.js new file mode 100644 index 00000000000..5a3a190371f --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.update_environment.js @@ -0,0 +1,73 @@ +// Copyright 2022 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'; + +function main(environment, updateMask) { + // [START dialogflow_v2_generated_Environments_UpdateEnvironment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The environment to update. + */ + // const environment = {} + /** + * Required. The mask to control which fields get updated. + */ + // const updateMask = {} + /** + * 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 = `-`). + */ + // const allowLoadToDraftAndDiscardChanges = true + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function callUpdateEnvironment() { + // Construct request + const request = { + environment, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateEnvironment(request); + console.log(response); + } + + callUpdateEnvironment(); + // [END dialogflow_v2_generated_Environments_UpdateEnvironment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/fulfillments.get_fulfillment.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/fulfillments.get_fulfillment.js new file mode 100644 index 00000000000..97b59e7c0df --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/fulfillments.get_fulfillment.js @@ -0,0 +1,62 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_Fulfillments_GetFulfillment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the fulfillment. + * Format: `projects//agent/fulfillment`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {FulfillmentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new FulfillmentsClient(); + + async function callGetFulfillment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getFulfillment(request); + console.log(response); + } + + callGetFulfillment(); + // [END dialogflow_v2_generated_Fulfillments_GetFulfillment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/fulfillments.update_fulfillment.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/fulfillments.update_fulfillment.js new file mode 100644 index 00000000000..2eaa4eaf921 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/fulfillments.update_fulfillment.js @@ -0,0 +1,67 @@ +// Copyright 2022 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'; + +function main(fulfillment, updateMask) { + // [START dialogflow_v2_generated_Fulfillments_UpdateFulfillment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The fulfillment to update. + */ + // const fulfillment = {} + /** + * Required. The mask to control which fields get updated. If the mask is not + * present, all fields will be updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {FulfillmentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new FulfillmentsClient(); + + async function callUpdateFulfillment() { + // Construct request + const request = { + fulfillment, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateFulfillment(request); + console.log(response); + } + + callUpdateFulfillment(); + // [END dialogflow_v2_generated_Fulfillments_UpdateFulfillment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.batch_delete_intents.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.batch_delete_intents.js new file mode 100644 index 00000000000..d383fb9171c --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.batch_delete_intents.js @@ -0,0 +1,69 @@ +// Copyright 2022 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'; + +function main(parent, intents) { + // [START dialogflow_v2_generated_Intents_BatchDeleteIntents_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the agent to delete all entities types for. Format: + * `projects//agent`. + */ + // const parent = 'abc123' + /** + * Required. The collection of intents to delete. Only intent `name` must be + * filled in. + */ + // const intents = 1234 + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callBatchDeleteIntents() { + // Construct request + const request = { + parent, + intents, + }; + + // Run request + const [operation] = await dialogflowClient.batchDeleteIntents(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchDeleteIntents(); + // [END dialogflow_v2_generated_Intents_BatchDeleteIntents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.batch_update_intents.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.batch_update_intents.js new file mode 100644 index 00000000000..95c585f6d99 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.batch_update_intents.js @@ -0,0 +1,89 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_Intents_BatchUpdateIntents_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the agent to update or create intents in. + * Format: `projects//agent`. + */ + // const parent = 'abc123' + /** + * 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://". + */ + // const intentBatchUri = 'abc123' + /** + * The collection of intents to update or create. + */ + // const intentBatchInline = {} + /** + * 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). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = {} + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callBatchUpdateIntents() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.batchUpdateIntents(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchUpdateIntents(); + // [END dialogflow_v2_generated_Intents_BatchUpdateIntents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.create_intent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.create_intent.js new file mode 100644 index 00000000000..67f3789c77b --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.create_intent.js @@ -0,0 +1,79 @@ +// Copyright 2022 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'; + +function main(parent, intent) { + // [START dialogflow_v2_generated_Intents_CreateIntent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to create a intent for. + * Format: `projects//agent`. + */ + // const parent = 'abc123' + /** + * Required. The intent to create. + */ + // const 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). + */ + // const languageCode = 'abc123' + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = {} + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callCreateIntent() { + // Construct request + const request = { + parent, + intent, + }; + + // Run request + const response = await dialogflowClient.createIntent(request); + console.log(response); + } + + callCreateIntent(); + // [END dialogflow_v2_generated_Intents_CreateIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.delete_intent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.delete_intent.js new file mode 100644 index 00000000000..f38f93dd1fc --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.delete_intent.js @@ -0,0 +1,63 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_Intents_DeleteIntent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the intent to delete. If this intent has direct or + * indirect followup intents, we also delete them. + * Format: `projects//agent/intents/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callDeleteIntent() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteIntent(request); + console.log(response); + } + + callDeleteIntent(); + // [END dialogflow_v2_generated_Intents_DeleteIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.get_intent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.get_intent.js new file mode 100644 index 00000000000..9031c7a23fe --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.get_intent.js @@ -0,0 +1,74 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_Intents_GetIntent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the intent. + * Format: `projects//agent/intents/`. + */ + // const name = 'abc123' + /** + * 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). + */ + // const languageCode = 'abc123' + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = {} + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callGetIntent() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getIntent(request); + console.log(response); + } + + callGetIntent(); + // [END dialogflow_v2_generated_Intents_GetIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.list_intents.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.list_intents.js new file mode 100644 index 00000000000..0868e386d58 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.list_intents.js @@ -0,0 +1,92 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_Intents_ListIntents_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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. + */ + // const parent = 'abc123' + /** + * 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). + */ + // const languageCode = 'abc123' + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = {} + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callListIntents() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listIntentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListIntents(); + // [END dialogflow_v2_generated_Intents_ListIntents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.update_intent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.update_intent.js new file mode 100644 index 00000000000..0cd8227a6a8 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.update_intent.js @@ -0,0 +1,77 @@ +// Copyright 2022 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'; + +function main(intent) { + // [START dialogflow_v2_generated_Intents_UpdateIntent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The intent to update. + */ + // const 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). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = {} + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callUpdateIntent() { + // Construct request + const request = { + intent, + }; + + // Run request + const response = await dialogflowClient.updateIntent(request); + console.log(response); + } + + callUpdateIntent(); + // [END dialogflow_v2_generated_Intents_UpdateIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.create_knowledge_base.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.create_knowledge_base.js new file mode 100644 index 00000000000..0f699b2799d --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.create_knowledge_base.js @@ -0,0 +1,67 @@ +// Copyright 2022 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'; + +function main(parent, knowledgeBase) { + // [START dialogflow_v2_generated_KnowledgeBases_CreateKnowledgeBase_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to create a knowledge base for. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Required. The knowledge base to create. + */ + // const knowledgeBase = {} + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function callCreateKnowledgeBase() { + // Construct request + const request = { + parent, + knowledgeBase, + }; + + // Run request + const response = await dialogflowClient.createKnowledgeBase(request); + console.log(response); + } + + callCreateKnowledgeBase(); + // [END dialogflow_v2_generated_KnowledgeBases_CreateKnowledgeBase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.delete_knowledge_base.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.delete_knowledge_base.js new file mode 100644 index 00000000000..35e6176174b --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.delete_knowledge_base.js @@ -0,0 +1,68 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_KnowledgeBases_DeleteKnowledgeBase_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the knowledge base to delete. + * Format: `projects//locations//knowledgeBases/`. + */ + // const name = 'abc123' + /** + * Optional. Force deletes the knowledge base. When set to true, any documents + * in the knowledge base are also deleted. + */ + // const force = true + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function callDeleteKnowledgeBase() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteKnowledgeBase(request); + console.log(response); + } + + callDeleteKnowledgeBase(); + // [END dialogflow_v2_generated_KnowledgeBases_DeleteKnowledgeBase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.get_knowledge_base.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.get_knowledge_base.js new file mode 100644 index 00000000000..613f3621c71 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.get_knowledge_base.js @@ -0,0 +1,63 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_KnowledgeBases_GetKnowledgeBase_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the knowledge base to retrieve. + * Format `projects//locations//knowledgeBases/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function callGetKnowledgeBase() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getKnowledgeBase(request); + console.log(response); + } + + callGetKnowledgeBase(); + // [END dialogflow_v2_generated_KnowledgeBases_GetKnowledgeBase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.list_knowledge_bases.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.list_knowledge_bases.js new file mode 100644 index 00000000000..e27e649ab8b --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.list_knowledge_bases.js @@ -0,0 +1,95 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_KnowledgeBases_ListKnowledgeBases_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to list of knowledge bases for. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return in a single page. By + * default 10 and at most 100. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + /** + * 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). + */ + // const filter = 'abc123' + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function callListKnowledgeBases() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listKnowledgeBasesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListKnowledgeBases(); + // [END dialogflow_v2_generated_KnowledgeBases_ListKnowledgeBases_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.update_knowledge_base.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.update_knowledge_base.js new file mode 100644 index 00000000000..cd5a5c60058 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.update_knowledge_base.js @@ -0,0 +1,67 @@ +// Copyright 2022 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'; + +function main(knowledgeBase) { + // [START dialogflow_v2_generated_KnowledgeBases_UpdateKnowledgeBase_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The knowledge base to update. + */ + // const knowledgeBase = {} + /** + * Optional. Not specified means `update all`. + * Currently, only `display_name` can be updated, an InvalidArgument will be + * returned for attempting to update other fields. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function callUpdateKnowledgeBase() { + // Construct request + const request = { + knowledgeBase, + }; + + // Run request + const response = await dialogflowClient.updateKnowledgeBase(request); + console.log(response); + } + + callUpdateKnowledgeBase(); + // [END dialogflow_v2_generated_KnowledgeBases_UpdateKnowledgeBase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.analyze_content.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.analyze_content.js new file mode 100644 index 00000000000..a8740f5355f --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.analyze_content.js @@ -0,0 +1,101 @@ +// Copyright 2022 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'; + +function main(participant) { + // [START dialogflow_v2_generated_Participants_AnalyzeContent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant this text comes from. + * Format: `projects//locations//conversations//participants/`. + */ + // const participant = 'abc123' + /** + * The natural language text to be processed. + */ + // const textInput = {} + /** + * An input event to send to Dialogflow. + */ + // const eventInput = {} + /** + * 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. + */ + // const replyAudioConfig = {} + /** + * Parameters for a Dialogflow virtual-agent query. + */ + // const queryParams = {} + /** + * Parameters for a human assist query. + */ + // const assistQueryParams = {} + /** + * Additional parameters to be put into Dialogflow CX session parameters. To + * remove a parameter from the session, clients should explicitly set the + * parameter value to null. + * Note: this field should only be used if you are connecting to a Dialogflow + * CX agent. + */ + // const cxParameters = {} + /** + * 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. + */ + // const requestId = 'abc123' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callAnalyzeContent() { + // Construct request + const request = { + participant, + }; + + // Run request + const response = await dialogflowClient.analyzeContent(request); + console.log(response); + } + + callAnalyzeContent(); + // [END dialogflow_v2_generated_Participants_AnalyzeContent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.create_participant.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.create_participant.js new file mode 100644 index 00000000000..13451c6bf04 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.create_participant.js @@ -0,0 +1,68 @@ +// Copyright 2022 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'; + +function main(parent, participant) { + // [START dialogflow_v2_generated_Participants_CreateParticipant_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource identifier of the conversation adding the participant. + * Format: `projects//locations//conversations/`. + */ + // const parent = 'abc123' + /** + * Required. The participant to create. + */ + // const participant = {} + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callCreateParticipant() { + // Construct request + const request = { + parent, + participant, + }; + + // Run request + const response = await dialogflowClient.createParticipant(request); + console.log(response); + } + + callCreateParticipant(); + // [END dialogflow_v2_generated_Participants_CreateParticipant_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.get_participant.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.get_participant.js new file mode 100644 index 00000000000..a40d3c106cf --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.get_participant.js @@ -0,0 +1,63 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_Participants_GetParticipant_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant. Format: + * `projects//locations//conversations//participants/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callGetParticipant() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getParticipant(request); + console.log(response); + } + + callGetParticipant(); + // [END dialogflow_v2_generated_Participants_GetParticipant_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.list_participants.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.list_participants.js new file mode 100644 index 00000000000..8b95d039a33 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.list_participants.js @@ -0,0 +1,74 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_Participants_ListParticipants_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The conversation to list all participants from. + * Format: `projects//locations//conversations/`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callListParticipants() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listParticipantsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListParticipants(); + // [END dialogflow_v2_generated_Participants_ListParticipants_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.streaming_analyze_content.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.streaming_analyze_content.js new file mode 100644 index 00000000000..5077043f390 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.streaming_analyze_content.js @@ -0,0 +1,125 @@ +// Copyright 2022 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'; + +function main(participant) { + // [START dialogflow_v2_generated_Participants_StreamingAnalyzeContent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant this text comes from. + * Format: `projects//locations//conversations//participants/`. + */ + // const participant = 'abc123' + /** + * Instructs the speech recognizer how to process the speech audio. + */ + // const audioConfig = {} + /** + * The natural language text to be processed. + */ + // const textConfig = {} + /** + * 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 + * StreamingAnalyzeContent. If this configuration is not supplied, speech + * synthesis is disabled. + */ + // const replyAudioConfig = {} + /** + * The input audio content to be recognized. Must be sent if `audio_config` + * is set in the first message. The complete audio over all streaming + * messages must not exceed 1 minute. + */ + // const inputAudio = 'Buffer.from('string')' + /** + * The UTF-8 encoded natural language text to be processed. Must be sent if + * `text_config` is set in the first message. Text length must not exceed + * 256 bytes for virtual agent interactions. The `input_text` field can be + * only sent once. + */ + // const inputText = 'abc123' + /** + * The DTMF digits used to invoke intent and fill in parameter value. + * This input is ignored if the previous response indicated that DTMF input + * is not accepted. + */ + // const inputDtmf = {} + /** + * Parameters for a Dialogflow virtual-agent query. + */ + // const queryParams = {} + /** + * Parameters for a human assist query. + */ + // const assistQueryParams = {} + /** + * Additional parameters to be put into Dialogflow CX session parameters. To + * remove a parameter from the session, clients should explicitly set the + * parameter value to null. + * Note: this field should only be used if you are connecting to a Dialogflow + * CX agent. + */ + // const cxParameters = {} + /** + * Enable partial virtual agent responses. If this flag is not enabled, + * response stream still contains only one final response even if some + * `Fulfillment`s in Dialogflow virtual agent have been configured to return + * partial responses. + */ + // const enablePartialAutomatedAgentReply = true + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callStreamingAnalyzeContent() { + // Construct request + const request = { + participant, + }; + + // Run request + const stream = await dialogflowClient.streamingAnalyzeContent(); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + stream.write(request); + stream.end(); + } + + callStreamingAnalyzeContent(); + // [END dialogflow_v2_generated_Participants_StreamingAnalyzeContent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.suggest_articles.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.suggest_articles.js new file mode 100644 index 00000000000..794835e5bd4 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.suggest_articles.js @@ -0,0 +1,80 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_Participants_SuggestArticles_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + */ + // const parent = 'abc123' + /** + * 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/`. + */ + // const latestMessage = 'abc123' + /** + * Optional. 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. + */ + // const contextSize = 1234 + /** + * Parameters for a human assist query. + */ + // const assistQueryParams = {} + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callSuggestArticles() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.suggestArticles(request); + console.log(response); + } + + callSuggestArticles(); + // [END dialogflow_v2_generated_Participants_SuggestArticles_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.suggest_faq_answers.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.suggest_faq_answers.js new file mode 100644 index 00000000000..ea6953e2593 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.suggest_faq_answers.js @@ -0,0 +1,80 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_Participants_SuggestFaqAnswers_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + */ + // const parent = 'abc123' + /** + * 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/`. + */ + // const latestMessage = 'abc123' + /** + * 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. + */ + // const contextSize = 1234 + /** + * Parameters for a human assist query. + */ + // const assistQueryParams = {} + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callSuggestFaqAnswers() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.suggestFaqAnswers(request); + console.log(response); + } + + callSuggestFaqAnswers(); + // [END dialogflow_v2_generated_Participants_SuggestFaqAnswers_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.suggest_smart_replies.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.suggest_smart_replies.js new file mode 100644 index 00000000000..6e15c4d4a83 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.suggest_smart_replies.js @@ -0,0 +1,82 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_Participants_SuggestSmartReplies_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + */ + // const parent = 'abc123' + /** + * 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. + */ + // const currentTextInput = {} + /** + * 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/`. + */ + // const latestMessage = 'abc123' + /** + * 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. + */ + // const contextSize = 1234 + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callSuggestSmartReplies() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.suggestSmartReplies(request); + console.log(response); + } + + callSuggestSmartReplies(); + // [END dialogflow_v2_generated_Participants_SuggestSmartReplies_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.update_participant.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.update_participant.js new file mode 100644 index 00000000000..1f54b8d8bb8 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.update_participant.js @@ -0,0 +1,66 @@ +// Copyright 2022 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'; + +function main(participant, updateMask) { + // [START dialogflow_v2_generated_Participants_UpdateParticipant_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The participant to update. + */ + // const participant = {} + /** + * Required. The mask to specify which fields to update. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callUpdateParticipant() { + // Construct request + const request = { + participant, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateParticipant(request); + console.log(response); + } + + callUpdateParticipant(); + // [END dialogflow_v2_generated_Participants_UpdateParticipant_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.create_session_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.create_session_entity_type.js new file mode 100644 index 00000000000..6326d522ce5 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.create_session_entity_type.js @@ -0,0 +1,71 @@ +// Copyright 2022 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'; + +function main(parent, sessionEntityType) { + // [START dialogflow_v2_generated_SessionEntityTypes_CreateSessionEntityType_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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. + */ + // const parent = 'abc123' + /** + * Required. The session entity type to create. + */ + // const sessionEntityType = {} + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function callCreateSessionEntityType() { + // Construct request + const request = { + parent, + sessionEntityType, + }; + + // Run request + const response = await dialogflowClient.createSessionEntityType(request); + console.log(response); + } + + callCreateSessionEntityType(); + // [END dialogflow_v2_generated_SessionEntityTypes_CreateSessionEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.delete_session_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.delete_session_entity_type.js new file mode 100644 index 00000000000..ba0bc98c285 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.delete_session_entity_type.js @@ -0,0 +1,67 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_SessionEntityTypes_DeleteSessionEntityType_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function callDeleteSessionEntityType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteSessionEntityType(request); + console.log(response); + } + + callDeleteSessionEntityType(); + // [END dialogflow_v2_generated_SessionEntityTypes_DeleteSessionEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.get_session_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.get_session_entity_type.js new file mode 100644 index 00000000000..7a60b72fce0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.get_session_entity_type.js @@ -0,0 +1,67 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_SessionEntityTypes_GetSessionEntityType_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function callGetSessionEntityType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getSessionEntityType(request); + console.log(response); + } + + callGetSessionEntityType(); + // [END dialogflow_v2_generated_SessionEntityTypes_GetSessionEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.list_session_entity_types.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.list_session_entity_types.js new file mode 100644 index 00000000000..87ccdabb650 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.list_session_entity_types.js @@ -0,0 +1,77 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_SessionEntityTypes_ListSessionEntityTypes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function callListSessionEntityTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listSessionEntityTypesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSessionEntityTypes(); + // [END dialogflow_v2_generated_SessionEntityTypes_ListSessionEntityTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.update_session_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.update_session_entity_type.js new file mode 100644 index 00000000000..1976e6fd8ee --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.update_session_entity_type.js @@ -0,0 +1,65 @@ +// Copyright 2022 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'; + +function main(sessionEntityType) { + // [START dialogflow_v2_generated_SessionEntityTypes_UpdateSessionEntityType_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The session entity type to update. + */ + // const sessionEntityType = {} + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function callUpdateSessionEntityType() { + // Construct request + const request = { + sessionEntityType, + }; + + // Run request + const response = await dialogflowClient.updateSessionEntityType(request); + console.log(response); + } + + callUpdateSessionEntityType(); + // [END dialogflow_v2_generated_SessionEntityTypes_UpdateSessionEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/sessions.detect_intent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/sessions.detect_intent.js new file mode 100644 index 00000000000..5c9419e8c4a --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/sessions.detect_intent.js @@ -0,0 +1,108 @@ +// Copyright 2022 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'; + +function main(session, queryInput) { + // [START dialogflow_v2_generated_Sessions_DetectIntent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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). + */ + // const session = 'abc123' + /** + * The parameters of this query. + */ + // const queryParams = {} + /** + * 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. + */ + // const queryInput = {} + /** + * 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. + */ + // const outputAudioConfig = {} + /** + * 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. + */ + // const outputAudioConfigMask = {} + /** + * 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. + */ + // const inputAudio = 'Buffer.from('string')' + + // Imports the Dialogflow library + const {SessionsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new SessionsClient(); + + async function callDetectIntent() { + // Construct request + const request = { + session, + queryInput, + }; + + // Run request + const response = await dialogflowClient.detectIntent(request); + console.log(response); + } + + callDetectIntent(); + // [END dialogflow_v2_generated_Sessions_DetectIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/sessions.streaming_detect_intent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/sessions.streaming_detect_intent.js new file mode 100644 index 00000000000..50370fc7c94 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/sessions.streaming_detect_intent.js @@ -0,0 +1,123 @@ +// Copyright 2022 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'; + +function main(session, queryInput) { + // [START dialogflow_v2_generated_Sessions_StreamingDetectIntent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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). + */ + // const session = 'abc123' + /** + * The parameters of this query. + */ + // const queryParams = {} + /** + * 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. + */ + // const queryInput = {} + /** + * 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. + */ + // const singleUtterance = 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. + */ + // const outputAudioConfig = {} + /** + * 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. + */ + // const outputAudioConfigMask = {} + /** + * 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. + */ + // const inputAudio = 'Buffer.from('string')' + + // Imports the Dialogflow library + const {SessionsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new SessionsClient(); + + async function callStreamingDetectIntent() { + // Construct request + const request = { + session, + queryInput, + }; + + // Run request + const stream = await dialogflowClient.streamingDetectIntent(); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + stream.write(request); + stream.end(); + } + + callStreamingDetectIntent(); + // [END dialogflow_v2_generated_Sessions_StreamingDetectIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/snippet_metadata.google.cloud.dialogflow.v2.json b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/snippet_metadata.google.cloud.dialogflow.v2.json new file mode 100644 index 00000000000..228fd7d6c00 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/snippet_metadata.google.cloud.dialogflow.v2.json @@ -0,0 +1,4731 @@ +{ + "clientLibrary": { + "name": "nodejs-dialogflow", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.dialogflow.v2", + "version": "v2" + } + ] + }, + "snippets": [ + { + "regionTag": "dialogflow_v2_generated_Agents_GetAgent_async", + "title": "dialogflow getAgent Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified agent.", + "canonical": true, + "file": "agents.get_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.GetAgent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Agent", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2.AgentsClient" + }, + "method": { + "shortName": "GetAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.GetAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Agents_SetAgent_async", + "title": "dialogflow setAgent Sample", + "origin": "API_DEFINITION", + "description": " 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).", + "canonical": true, + "file": "agents.set_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.SetAgent", + "async": true, + "parameters": [ + { + "name": "agent", + "type": ".google.cloud.dialogflow.v2.Agent" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Agent", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2.AgentsClient" + }, + "method": { + "shortName": "SetAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.SetAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Agents_DeleteAgent_async", + "title": "dialogflow deleteAgent Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified agent.", + "canonical": true, + "file": "agents.delete_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.DeleteAgent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2.AgentsClient" + }, + "method": { + "shortName": "DeleteAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.DeleteAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Agents_SearchAgents_async", + "title": "dialogflow searchAgents Sample", + "origin": "API_DEFINITION", + "description": " 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).", + "canonical": true, + "file": "agents.search_agents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SearchAgents", + "fullName": "google.cloud.dialogflow.v2.Agents.SearchAgents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.SearchAgentsResponse", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2.AgentsClient" + }, + "method": { + "shortName": "SearchAgents", + "fullName": "google.cloud.dialogflow.v2.Agents.SearchAgents", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Agents_TrainAgent_async", + "title": "dialogflow trainAgent Sample", + "origin": "API_DEFINITION", + "description": " Trains the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "agents.train_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TrainAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.TrainAgent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2.AgentsClient" + }, + "method": { + "shortName": "TrainAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.TrainAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Agents_ExportAgent_async", + "title": "dialogflow exportAgent Sample", + "origin": "API_DEFINITION", + "description": " Exports the specified agent to a ZIP file. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]", + "canonical": true, + "file": "agents.export_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ExportAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.ExportAgent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "agent_uri", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2.AgentsClient" + }, + "method": { + "shortName": "ExportAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.ExportAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Agents_ImportAgent_async", + "title": "dialogflow importAgent Sample", + "origin": "API_DEFINITION", + "description": " 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. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) The operation only tracks when importing is complete, 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).", + "canonical": true, + "file": "agents.import_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.ImportAgent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "agent_uri", + "type": "TYPE_STRING" + }, + { + "name": "agent_content", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2.AgentsClient" + }, + "method": { + "shortName": "ImportAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.ImportAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Agents_RestoreAgent_async", + "title": "dialogflow restoreAgent Sample", + "origin": "API_DEFINITION", + "description": " 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. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) The operation only tracks when restoring is complete, 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).", + "canonical": true, + "file": "agents.restore_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RestoreAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.RestoreAgent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "agent_uri", + "type": "TYPE_STRING" + }, + { + "name": "agent_content", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2.AgentsClient" + }, + "method": { + "shortName": "RestoreAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.RestoreAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Agents_GetValidationResult_async", + "title": "dialogflow getValidationResult Sample", + "origin": "API_DEFINITION", + "description": " Gets agent validation result. Agent validation is performed during training time and is updated automatically when training is completed.", + "canonical": true, + "file": "agents.get_validation_result.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetValidationResult", + "fullName": "google.cloud.dialogflow.v2.Agents.GetValidationResult", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ValidationResult", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2.AgentsClient" + }, + "method": { + "shortName": "GetValidationResult", + "fullName": "google.cloud.dialogflow.v2.Agents.GetValidationResult", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_AnswerRecords_ListAnswerRecords_async", + "title": "dialogflow listAnswerRecords Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all answer records in the specified project in reverse chronological order.", + "canonical": true, + "file": "answer_records.list_answer_records.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAnswerRecords", + "fullName": "google.cloud.dialogflow.v2.AnswerRecords.ListAnswerRecords", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListAnswerRecordsResponse", + "client": { + "shortName": "AnswerRecordsClient", + "fullName": "google.cloud.dialogflow.v2.AnswerRecordsClient" + }, + "method": { + "shortName": "ListAnswerRecords", + "fullName": "google.cloud.dialogflow.v2.AnswerRecords.ListAnswerRecords", + "service": { + "shortName": "AnswerRecords", + "fullName": "google.cloud.dialogflow.v2.AnswerRecords" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_AnswerRecords_UpdateAnswerRecord_async", + "title": "dialogflow updateAnswerRecord Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified answer record.", + "canonical": true, + "file": "answer_records.update_answer_record.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateAnswerRecord", + "fullName": "google.cloud.dialogflow.v2.AnswerRecords.UpdateAnswerRecord", + "async": true, + "parameters": [ + { + "name": "answer_record", + "type": ".google.cloud.dialogflow.v2.AnswerRecord" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2.AnswerRecord", + "client": { + "shortName": "AnswerRecordsClient", + "fullName": "google.cloud.dialogflow.v2.AnswerRecordsClient" + }, + "method": { + "shortName": "UpdateAnswerRecord", + "fullName": "google.cloud.dialogflow.v2.AnswerRecords.UpdateAnswerRecord", + "service": { + "shortName": "AnswerRecords", + "fullName": "google.cloud.dialogflow.v2.AnswerRecords" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Contexts_ListContexts_async", + "title": "dialogflow listContexts Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all contexts in the specified session.", + "canonical": true, + "file": "contexts.list_contexts.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListContexts", + "fullName": "google.cloud.dialogflow.v2.Contexts.ListContexts", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListContextsResponse", + "client": { + "shortName": "ContextsClient", + "fullName": "google.cloud.dialogflow.v2.ContextsClient" + }, + "method": { + "shortName": "ListContexts", + "fullName": "google.cloud.dialogflow.v2.Contexts.ListContexts", + "service": { + "shortName": "Contexts", + "fullName": "google.cloud.dialogflow.v2.Contexts" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Contexts_GetContext_async", + "title": "dialogflow getContext Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified context.", + "canonical": true, + "file": "contexts.get_context.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetContext", + "fullName": "google.cloud.dialogflow.v2.Contexts.GetContext", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Context", + "client": { + "shortName": "ContextsClient", + "fullName": "google.cloud.dialogflow.v2.ContextsClient" + }, + "method": { + "shortName": "GetContext", + "fullName": "google.cloud.dialogflow.v2.Contexts.GetContext", + "service": { + "shortName": "Contexts", + "fullName": "google.cloud.dialogflow.v2.Contexts" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Contexts_CreateContext_async", + "title": "dialogflow createContext Sample", + "origin": "API_DEFINITION", + "description": " Creates a context. If the specified context already exists, overrides the context.", + "canonical": true, + "file": "contexts.create_context.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateContext", + "fullName": "google.cloud.dialogflow.v2.Contexts.CreateContext", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "context", + "type": ".google.cloud.dialogflow.v2.Context" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Context", + "client": { + "shortName": "ContextsClient", + "fullName": "google.cloud.dialogflow.v2.ContextsClient" + }, + "method": { + "shortName": "CreateContext", + "fullName": "google.cloud.dialogflow.v2.Contexts.CreateContext", + "service": { + "shortName": "Contexts", + "fullName": "google.cloud.dialogflow.v2.Contexts" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Contexts_UpdateContext_async", + "title": "dialogflow updateContext Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified context.", + "canonical": true, + "file": "contexts.update_context.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateContext", + "fullName": "google.cloud.dialogflow.v2.Contexts.UpdateContext", + "async": true, + "parameters": [ + { + "name": "context", + "type": ".google.cloud.dialogflow.v2.Context" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Context", + "client": { + "shortName": "ContextsClient", + "fullName": "google.cloud.dialogflow.v2.ContextsClient" + }, + "method": { + "shortName": "UpdateContext", + "fullName": "google.cloud.dialogflow.v2.Contexts.UpdateContext", + "service": { + "shortName": "Contexts", + "fullName": "google.cloud.dialogflow.v2.Contexts" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Contexts_DeleteContext_async", + "title": "dialogflow deleteContext Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified context.", + "canonical": true, + "file": "contexts.delete_context.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteContext", + "fullName": "google.cloud.dialogflow.v2.Contexts.DeleteContext", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ContextsClient", + "fullName": "google.cloud.dialogflow.v2.ContextsClient" + }, + "method": { + "shortName": "DeleteContext", + "fullName": "google.cloud.dialogflow.v2.Contexts.DeleteContext", + "service": { + "shortName": "Contexts", + "fullName": "google.cloud.dialogflow.v2.Contexts" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Contexts_DeleteAllContexts_async", + "title": "dialogflow deleteAllContexts Sample", + "origin": "API_DEFINITION", + "description": " Deletes all active contexts in the specified session.", + "canonical": true, + "file": "contexts.delete_all_contexts.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteAllContexts", + "fullName": "google.cloud.dialogflow.v2.Contexts.DeleteAllContexts", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ContextsClient", + "fullName": "google.cloud.dialogflow.v2.ContextsClient" + }, + "method": { + "shortName": "DeleteAllContexts", + "fullName": "google.cloud.dialogflow.v2.Contexts.DeleteAllContexts", + "service": { + "shortName": "Contexts", + "fullName": "google.cloud.dialogflow.v2.Contexts" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationDatasets_CreateConversationDataset_async", + "title": "dialogflow createConversationDataset Sample", + "origin": "API_DEFINITION", + "description": " Creates a new conversation dataset. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [CreateConversationDatasetOperationMetadata][google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata] - `response`: [ConversationDataset][google.cloud.dialogflow.v2.ConversationDataset]", + "canonical": true, + "file": "conversation_datasets.create_conversation_dataset.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateConversationDataset", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.CreateConversationDataset", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "conversation_dataset", + "type": ".google.cloud.dialogflow.v2.ConversationDataset" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConversationDatasetsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasetsClient" + }, + "method": { + "shortName": "CreateConversationDataset", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.CreateConversationDataset", + "service": { + "shortName": "ConversationDatasets", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationDatasets_GetConversationDataset_async", + "title": "dialogflow getConversationDataset Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified conversation dataset.", + "canonical": true, + "file": "conversation_datasets.get_conversation_dataset.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetConversationDataset", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.GetConversationDataset", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ConversationDataset", + "client": { + "shortName": "ConversationDatasetsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasetsClient" + }, + "method": { + "shortName": "GetConversationDataset", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.GetConversationDataset", + "service": { + "shortName": "ConversationDatasets", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationDatasets_ListConversationDatasets_async", + "title": "dialogflow listConversationDatasets Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all conversation datasets in the specified project and location.", + "canonical": true, + "file": "conversation_datasets.list_conversation_datasets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListConversationDatasets", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.ListConversationDatasets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListConversationDatasetsResponse", + "client": { + "shortName": "ConversationDatasetsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasetsClient" + }, + "method": { + "shortName": "ListConversationDatasets", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.ListConversationDatasets", + "service": { + "shortName": "ConversationDatasets", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationDatasets_DeleteConversationDataset_async", + "title": "dialogflow deleteConversationDataset Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified conversation dataset. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [DeleteConversationDatasetOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)", + "canonical": true, + "file": "conversation_datasets.delete_conversation_dataset.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteConversationDataset", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.DeleteConversationDataset", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConversationDatasetsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasetsClient" + }, + "method": { + "shortName": "DeleteConversationDataset", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.DeleteConversationDataset", + "service": { + "shortName": "ConversationDatasets", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationDatasets_ImportConversationData_async", + "title": "dialogflow importConversationData Sample", + "origin": "API_DEFINITION", + "description": " Import data into the specified conversation dataset. Note that it is not allowed to import data to a conversation dataset that already has data in it. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [ImportConversationDataOperationMetadata][google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata] - `response`: [ImportConversationDataOperationResponse][google.cloud.dialogflow.v2.ImportConversationDataOperationResponse]", + "canonical": true, + "file": "conversation_datasets.import_conversation_data.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportConversationData", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.dialogflow.v2.InputConfig" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConversationDatasetsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasetsClient" + }, + "method": { + "shortName": "ImportConversationData", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData", + "service": { + "shortName": "ConversationDatasets", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationModels_CreateConversationModel_async", + "title": "dialogflow createConversationModel Sample", + "origin": "API_DEFINITION", + "description": " Creates a model. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [CreateConversationModelOperationMetadata][google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata] - `response`: [ConversationModel][google.cloud.dialogflow.v2.ConversationModel]", + "canonical": true, + "file": "conversation_models.create_conversation_model.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateConversationModel", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.CreateConversationModel", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "conversation_model", + "type": ".google.cloud.dialogflow.v2.ConversationModel" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConversationModelsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" + }, + "method": { + "shortName": "CreateConversationModel", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.CreateConversationModel", + "service": { + "shortName": "ConversationModels", + "fullName": "google.cloud.dialogflow.v2.ConversationModels" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationModels_GetConversationModel_async", + "title": "dialogflow getConversationModel Sample", + "origin": "API_DEFINITION", + "description": " Gets conversation model.", + "canonical": true, + "file": "conversation_models.get_conversation_model.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetConversationModel", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.GetConversationModel", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ConversationModel", + "client": { + "shortName": "ConversationModelsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" + }, + "method": { + "shortName": "GetConversationModel", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.GetConversationModel", + "service": { + "shortName": "ConversationModels", + "fullName": "google.cloud.dialogflow.v2.ConversationModels" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationModels_ListConversationModels_async", + "title": "dialogflow listConversationModels Sample", + "origin": "API_DEFINITION", + "description": " Lists conversation models.", + "canonical": true, + "file": "conversation_models.list_conversation_models.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListConversationModels", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.ListConversationModels", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListConversationModelsResponse", + "client": { + "shortName": "ConversationModelsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" + }, + "method": { + "shortName": "ListConversationModels", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.ListConversationModels", + "service": { + "shortName": "ConversationModels", + "fullName": "google.cloud.dialogflow.v2.ConversationModels" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationModels_DeleteConversationModel_async", + "title": "dialogflow deleteConversationModel Sample", + "origin": "API_DEFINITION", + "description": " Deletes a model. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [DeleteConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)", + "canonical": true, + "file": "conversation_models.delete_conversation_model.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteConversationModel", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.DeleteConversationModel", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConversationModelsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" + }, + "method": { + "shortName": "DeleteConversationModel", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.DeleteConversationModel", + "service": { + "shortName": "ConversationModels", + "fullName": "google.cloud.dialogflow.v2.ConversationModels" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationModels_DeployConversationModel_async", + "title": "dialogflow deployConversationModel Sample", + "origin": "API_DEFINITION", + "description": " Deploys a model. If a model is already deployed, deploying it has no effect. A model can only serve prediction requests after it gets deployed. For article suggestion, custom model will not be used unless it is deployed. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [DeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)", + "canonical": true, + "file": "conversation_models.deploy_conversation_model.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeployConversationModel", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.DeployConversationModel", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConversationModelsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" + }, + "method": { + "shortName": "DeployConversationModel", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.DeployConversationModel", + "service": { + "shortName": "ConversationModels", + "fullName": "google.cloud.dialogflow.v2.ConversationModels" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationModels_UndeployConversationModel_async", + "title": "dialogflow undeployConversationModel Sample", + "origin": "API_DEFINITION", + "description": " Undeploys a model. If the model is not deployed this method has no effect. If the model is currently being used: - For article suggestion, article suggestion will fallback to the default model if model is undeployed. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [UndeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)", + "canonical": true, + "file": "conversation_models.undeploy_conversation_model.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UndeployConversationModel", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.UndeployConversationModel", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConversationModelsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" + }, + "method": { + "shortName": "UndeployConversationModel", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.UndeployConversationModel", + "service": { + "shortName": "ConversationModels", + "fullName": "google.cloud.dialogflow.v2.ConversationModels" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationModels_GetConversationModelEvaluation_async", + "title": "dialogflow getConversationModelEvaluation Sample", + "origin": "API_DEFINITION", + "description": " Gets an evaluation of conversation model.", + "canonical": true, + "file": "conversation_models.get_conversation_model_evaluation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetConversationModelEvaluation", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.GetConversationModelEvaluation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ConversationModelEvaluation", + "client": { + "shortName": "ConversationModelsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" + }, + "method": { + "shortName": "GetConversationModelEvaluation", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.GetConversationModelEvaluation", + "service": { + "shortName": "ConversationModels", + "fullName": "google.cloud.dialogflow.v2.ConversationModels" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationModels_ListConversationModelEvaluations_async", + "title": "dialogflow listConversationModelEvaluations Sample", + "origin": "API_DEFINITION", + "description": " Lists evaluations of a conversation model.", + "canonical": true, + "file": "conversation_models.list_conversation_model_evaluations.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListConversationModelEvaluations", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.ListConversationModelEvaluations", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse", + "client": { + "shortName": "ConversationModelsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" + }, + "method": { + "shortName": "ListConversationModelEvaluations", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.ListConversationModelEvaluations", + "service": { + "shortName": "ConversationModels", + "fullName": "google.cloud.dialogflow.v2.ConversationModels" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationModels_CreateConversationModelEvaluation_async", + "title": "dialogflow createConversationModelEvaluation Sample", + "origin": "API_DEFINITION", + "description": " Creates evaluation of a conversation model.", + "canonical": true, + "file": "conversation_models.create_conversation_model_evaluation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateConversationModelEvaluation", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.CreateConversationModelEvaluation", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "conversation_model_evaluation", + "type": ".google.cloud.dialogflow.v2.ConversationModelEvaluation" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConversationModelsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" + }, + "method": { + "shortName": "CreateConversationModelEvaluation", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.CreateConversationModelEvaluation", + "service": { + "shortName": "ConversationModels", + "fullName": "google.cloud.dialogflow.v2.ConversationModels" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationProfiles_ListConversationProfiles_async", + "title": "dialogflow listConversationProfiles Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all conversation profiles in the specified project.", + "canonical": true, + "file": "conversation_profiles.list_conversation_profiles.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListConversationProfiles", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.ListConversationProfiles", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListConversationProfilesResponse", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2.ConversationProfilesClient" + }, + "method": { + "shortName": "ListConversationProfiles", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.ListConversationProfiles", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationProfiles_GetConversationProfile_async", + "title": "dialogflow getConversationProfile Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified conversation profile.", + "canonical": true, + "file": "conversation_profiles.get_conversation_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetConversationProfile", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ConversationProfile", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2.ConversationProfilesClient" + }, + "method": { + "shortName": "GetConversationProfile", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationProfiles_CreateConversationProfile_async", + "title": "dialogflow createConversationProfile Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "conversation_profiles.create_conversation_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateConversationProfile", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.CreateConversationProfile", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "conversation_profile", + "type": ".google.cloud.dialogflow.v2.ConversationProfile" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ConversationProfile", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2.ConversationProfilesClient" + }, + "method": { + "shortName": "CreateConversationProfile", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.CreateConversationProfile", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationProfiles_UpdateConversationProfile_async", + "title": "dialogflow updateConversationProfile Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "conversation_profiles.update_conversation_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateConversationProfile", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.UpdateConversationProfile", + "async": true, + "parameters": [ + { + "name": "conversation_profile", + "type": ".google.cloud.dialogflow.v2.ConversationProfile" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ConversationProfile", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2.ConversationProfilesClient" + }, + "method": { + "shortName": "UpdateConversationProfile", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.UpdateConversationProfile", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationProfiles_DeleteConversationProfile_async", + "title": "dialogflow deleteConversationProfile Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified conversation profile.", + "canonical": true, + "file": "conversation_profiles.delete_conversation_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteConversationProfile", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.DeleteConversationProfile", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2.ConversationProfilesClient" + }, + "method": { + "shortName": "DeleteConversationProfile", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.DeleteConversationProfile", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationProfiles_SetSuggestionFeatureConfig_async", + "title": "dialogflow setSuggestionFeatureConfig Sample", + "origin": "API_DEFINITION", + "description": " Adds or updates a suggestion feature in a conversation profile. If the conversation profile contains the type of suggestion feature for the participant role, it will update it. Otherwise it will insert the suggestion feature. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [SetSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata] - `response`: [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile] If a long running operation to add or update suggestion feature config for the same conversation profile, participant role and suggestion feature type exists, please cancel the existing long running operation before sending such request, otherwise the request will be rejected.", + "canonical": true, + "file": "conversation_profiles.set_suggestion_feature_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetSuggestionFeatureConfig", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.SetSuggestionFeatureConfig", + "async": true, + "parameters": [ + { + "name": "conversation_profile", + "type": "TYPE_STRING" + }, + { + "name": "participant_role", + "type": ".google.cloud.dialogflow.v2.Participant.Role" + }, + { + "name": "suggestion_feature_config", + "type": ".google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2.ConversationProfilesClient" + }, + "method": { + "shortName": "SetSuggestionFeatureConfig", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.SetSuggestionFeatureConfig", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async", + "title": "dialogflow clearSuggestionFeatureConfig Sample", + "origin": "API_DEFINITION", + "description": " Clears a suggestion feature from a conversation profile for the given participant role. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [ClearSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata] - `response`: [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile]", + "canonical": true, + "file": "conversation_profiles.clear_suggestion_feature_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ClearSuggestionFeatureConfig", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.ClearSuggestionFeatureConfig", + "async": true, + "parameters": [ + { + "name": "conversation_profile", + "type": "TYPE_STRING" + }, + { + "name": "participant_role", + "type": ".google.cloud.dialogflow.v2.Participant.Role" + }, + { + "name": "suggestion_feature_type", + "type": ".google.cloud.dialogflow.v2.SuggestionFeature.Type" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2.ConversationProfilesClient" + }, + "method": { + "shortName": "ClearSuggestionFeatureConfig", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.ClearSuggestionFeatureConfig", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Conversations_CreateConversation_async", + "title": "dialogflow createConversation Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "conversations.create_conversation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateConversation", + "fullName": "google.cloud.dialogflow.v2.Conversations.CreateConversation", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "conversation", + "type": ".google.cloud.dialogflow.v2.Conversation" + }, + { + "name": "conversation_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Conversation", + "client": { + "shortName": "ConversationsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationsClient" + }, + "method": { + "shortName": "CreateConversation", + "fullName": "google.cloud.dialogflow.v2.Conversations.CreateConversation", + "service": { + "shortName": "Conversations", + "fullName": "google.cloud.dialogflow.v2.Conversations" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Conversations_ListConversations_async", + "title": "dialogflow listConversations Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all conversations in the specified project.", + "canonical": true, + "file": "conversations.list_conversations.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListConversations", + "fullName": "google.cloud.dialogflow.v2.Conversations.ListConversations", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListConversationsResponse", + "client": { + "shortName": "ConversationsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationsClient" + }, + "method": { + "shortName": "ListConversations", + "fullName": "google.cloud.dialogflow.v2.Conversations.ListConversations", + "service": { + "shortName": "Conversations", + "fullName": "google.cloud.dialogflow.v2.Conversations" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Conversations_GetConversation_async", + "title": "dialogflow getConversation Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specific conversation.", + "canonical": true, + "file": "conversations.get_conversation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetConversation", + "fullName": "google.cloud.dialogflow.v2.Conversations.GetConversation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Conversation", + "client": { + "shortName": "ConversationsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationsClient" + }, + "method": { + "shortName": "GetConversation", + "fullName": "google.cloud.dialogflow.v2.Conversations.GetConversation", + "service": { + "shortName": "Conversations", + "fullName": "google.cloud.dialogflow.v2.Conversations" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Conversations_CompleteConversation_async", + "title": "dialogflow completeConversation Sample", + "origin": "API_DEFINITION", + "description": " Completes the specified conversation. Finished conversations are purged from the database after 30 days.", + "canonical": true, + "file": "conversations.complete_conversation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CompleteConversation", + "fullName": "google.cloud.dialogflow.v2.Conversations.CompleteConversation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Conversation", + "client": { + "shortName": "ConversationsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationsClient" + }, + "method": { + "shortName": "CompleteConversation", + "fullName": "google.cloud.dialogflow.v2.Conversations.CompleteConversation", + "service": { + "shortName": "Conversations", + "fullName": "google.cloud.dialogflow.v2.Conversations" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Conversations_ListMessages_async", + "title": "dialogflow listMessages Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "conversations.list_messages.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListMessages", + "fullName": "google.cloud.dialogflow.v2.Conversations.ListMessages", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListMessagesResponse", + "client": { + "shortName": "ConversationsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationsClient" + }, + "method": { + "shortName": "ListMessages", + "fullName": "google.cloud.dialogflow.v2.Conversations.ListMessages", + "service": { + "shortName": "Conversations", + "fullName": "google.cloud.dialogflow.v2.Conversations" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Documents_ListDocuments_async", + "title": "dialogflow listDocuments Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all documents of the knowledge base.", + "canonical": true, + "file": "documents.list_documents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListDocuments", + "fullName": "google.cloud.dialogflow.v2.Documents.ListDocuments", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListDocumentsResponse", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2.DocumentsClient" + }, + "method": { + "shortName": "ListDocuments", + "fullName": "google.cloud.dialogflow.v2.Documents.ListDocuments", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Documents_GetDocument_async", + "title": "dialogflow getDocument Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified document.", + "canonical": true, + "file": "documents.get_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDocument", + "fullName": "google.cloud.dialogflow.v2.Documents.GetDocument", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Document", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2.DocumentsClient" + }, + "method": { + "shortName": "GetDocument", + "fullName": "google.cloud.dialogflow.v2.Documents.GetDocument", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Documents_CreateDocument_async", + "title": "dialogflow createDocument Sample", + "origin": "API_DEFINITION", + "description": " Creates a new document. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] - `response`: [Document][google.cloud.dialogflow.v2.Document]", + "canonical": true, + "file": "documents.create_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateDocument", + "fullName": "google.cloud.dialogflow.v2.Documents.CreateDocument", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "document", + "type": ".google.cloud.dialogflow.v2.Document" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2.DocumentsClient" + }, + "method": { + "shortName": "CreateDocument", + "fullName": "google.cloud.dialogflow.v2.Documents.CreateDocument", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Documents_ImportDocuments_async", + "title": "dialogflow importDocuments Sample", + "origin": "API_DEFINITION", + "description": " Creates 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. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] - `response`: [ImportDocumentsResponse][google.cloud.dialogflow.v2.ImportDocumentsResponse]", + "canonical": true, + "file": "documents.import_documents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportDocuments", + "fullName": "google.cloud.dialogflow.v2.Documents.ImportDocuments", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "gcs_source", + "type": ".google.cloud.dialogflow.v2.GcsSources" + }, + { + "name": "document_template", + "type": ".google.cloud.dialogflow.v2.ImportDocumentTemplate" + }, + { + "name": "import_gcs_custom_metadata", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2.DocumentsClient" + }, + "method": { + "shortName": "ImportDocuments", + "fullName": "google.cloud.dialogflow.v2.Documents.ImportDocuments", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Documents_DeleteDocument_async", + "title": "dialogflow deleteDocument Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified document. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)", + "canonical": true, + "file": "documents.delete_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteDocument", + "fullName": "google.cloud.dialogflow.v2.Documents.DeleteDocument", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2.DocumentsClient" + }, + "method": { + "shortName": "DeleteDocument", + "fullName": "google.cloud.dialogflow.v2.Documents.DeleteDocument", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Documents_UpdateDocument_async", + "title": "dialogflow updateDocument Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified document. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] - `response`: [Document][google.cloud.dialogflow.v2.Document]", + "canonical": true, + "file": "documents.update_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateDocument", + "fullName": "google.cloud.dialogflow.v2.Documents.UpdateDocument", + "async": true, + "parameters": [ + { + "name": "document", + "type": ".google.cloud.dialogflow.v2.Document" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2.DocumentsClient" + }, + "method": { + "shortName": "UpdateDocument", + "fullName": "google.cloud.dialogflow.v2.Documents.UpdateDocument", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Documents_ReloadDocument_async", + "title": "dialogflow reloadDocument Sample", + "origin": "API_DEFINITION", + "description": " 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. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] - `response`: [Document][google.cloud.dialogflow.v2.Document] Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.", + "canonical": true, + "file": "documents.reload_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReloadDocument", + "fullName": "google.cloud.dialogflow.v2.Documents.ReloadDocument", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "content_uri", + "type": "TYPE_STRING" + }, + { + "name": "import_gcs_custom_metadata", + "type": "TYPE_BOOL" + }, + { + "name": "smart_messaging_partial_update", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2.DocumentsClient" + }, + "method": { + "shortName": "ReloadDocument", + "fullName": "google.cloud.dialogflow.v2.Documents.ReloadDocument", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Documents_ExportDocument_async", + "title": "dialogflow exportDocument Sample", + "origin": "API_DEFINITION", + "description": " Exports a smart messaging candidate document into the specified destination. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] - `response`: [Document][google.cloud.dialogflow.v2.Document]", + "canonical": true, + "file": "documents.export_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ExportDocument", + "fullName": "google.cloud.dialogflow.v2.Documents.ExportDocument", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "gcs_destination", + "type": ".google.cloud.dialogflow.v2.GcsDestination" + }, + { + "name": "export_full_content", + "type": "TYPE_BOOL" + }, + { + "name": "smart_messaging_partial_update", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2.DocumentsClient" + }, + "method": { + "shortName": "ExportDocument", + "fullName": "google.cloud.dialogflow.v2.Documents.ExportDocument", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_EntityTypes_ListEntityTypes_async", + "title": "dialogflow listEntityTypes Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all entity types in the specified agent.", + "canonical": true, + "file": "entity_types.list_entity_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListEntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListEntityTypesResponse", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" + }, + "method": { + "shortName": "ListEntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_EntityTypes_GetEntityType_async", + "title": "dialogflow getEntityType Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified entity type.", + "canonical": true, + "file": "entity_types.get_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetEntityType", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.GetEntityType", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.EntityType", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" + }, + "method": { + "shortName": "GetEntityType", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.GetEntityType", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_EntityTypes_CreateEntityType_async", + "title": "dialogflow createEntityType Sample", + "origin": "API_DEFINITION", + "description": " 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).", + "canonical": true, + "file": "entity_types.create_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateEntityType", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.CreateEntityType", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "entity_type", + "type": ".google.cloud.dialogflow.v2.EntityType" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.EntityType", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" + }, + "method": { + "shortName": "CreateEntityType", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.CreateEntityType", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_EntityTypes_UpdateEntityType_async", + "title": "dialogflow updateEntityType Sample", + "origin": "API_DEFINITION", + "description": " 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).", + "canonical": true, + "file": "entity_types.update_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateEntityType", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.UpdateEntityType", + "async": true, + "parameters": [ + { + "name": "entity_type", + "type": ".google.cloud.dialogflow.v2.EntityType" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2.EntityType", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" + }, + "method": { + "shortName": "UpdateEntityType", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.UpdateEntityType", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_EntityTypes_DeleteEntityType_async", + "title": "dialogflow deleteEntityType Sample", + "origin": "API_DEFINITION", + "description": " 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).", + "canonical": true, + "file": "entity_types.delete_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteEntityType", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.DeleteEntityType", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" + }, + "method": { + "shortName": "DeleteEntityType", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.DeleteEntityType", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_EntityTypes_BatchUpdateEntityTypes_async", + "title": "dialogflow batchUpdateEntityTypes Sample", + "origin": "API_DEFINITION", + "description": " Updates/Creates multiple entity types in the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [BatchUpdateEntityTypesResponse][google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse] Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "entity_types.batch_update_entity_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchUpdateEntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "entity_type_batch_uri", + "type": "TYPE_STRING" + }, + { + "name": "entity_type_batch_inline", + "type": ".google.cloud.dialogflow.v2.EntityTypeBatch" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" + }, + "method": { + "shortName": "BatchUpdateEntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_EntityTypes_BatchDeleteEntityTypes_async", + "title": "dialogflow batchDeleteEntityTypes Sample", + "origin": "API_DEFINITION", + "description": " Deletes entity types in the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "entity_types.batch_delete_entity_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchDeleteEntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntityTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "entity_type_names", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" + }, + "method": { + "shortName": "BatchDeleteEntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntityTypes", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_EntityTypes_BatchCreateEntities_async", + "title": "dialogflow batchCreateEntities Sample", + "origin": "API_DEFINITION", + "description": " Creates multiple new entities in the specified entity type. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "entity_types.batch_create_entities.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchCreateEntities", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchCreateEntities", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "entities", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" + }, + "method": { + "shortName": "BatchCreateEntities", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchCreateEntities", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_EntityTypes_BatchUpdateEntities_async", + "title": "dialogflow batchUpdateEntities Sample", + "origin": "API_DEFINITION", + "description": " 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. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "entity_types.batch_update_entities.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchUpdateEntities", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntities", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "entities", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" + }, + "method": { + "shortName": "BatchUpdateEntities", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntities", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_EntityTypes_BatchDeleteEntities_async", + "title": "dialogflow batchDeleteEntities Sample", + "origin": "API_DEFINITION", + "description": " Deletes entities in the specified entity type. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "entity_types.batch_delete_entities.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchDeleteEntities", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntities", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "entity_values", + "type": "TYPE_STRING[]" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" + }, + "method": { + "shortName": "BatchDeleteEntities", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntities", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Environments_ListEnvironments_async", + "title": "dialogflow listEnvironments Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all non-default environments of the specified agent.", + "canonical": true, + "file": "environments.list_environments.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListEnvironments", + "fullName": "google.cloud.dialogflow.v2.Environments.ListEnvironments", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListEnvironmentsResponse", + "client": { + "shortName": "EnvironmentsClient", + "fullName": "google.cloud.dialogflow.v2.EnvironmentsClient" + }, + "method": { + "shortName": "ListEnvironments", + "fullName": "google.cloud.dialogflow.v2.Environments.ListEnvironments", + "service": { + "shortName": "Environments", + "fullName": "google.cloud.dialogflow.v2.Environments" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Environments_GetEnvironment_async", + "title": "dialogflow getEnvironment Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified agent environment.", + "canonical": true, + "file": "environments.get_environment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetEnvironment", + "fullName": "google.cloud.dialogflow.v2.Environments.GetEnvironment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Environment", + "client": { + "shortName": "EnvironmentsClient", + "fullName": "google.cloud.dialogflow.v2.EnvironmentsClient" + }, + "method": { + "shortName": "GetEnvironment", + "fullName": "google.cloud.dialogflow.v2.Environments.GetEnvironment", + "service": { + "shortName": "Environments", + "fullName": "google.cloud.dialogflow.v2.Environments" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Environments_CreateEnvironment_async", + "title": "dialogflow createEnvironment Sample", + "origin": "API_DEFINITION", + "description": " Creates an agent environment.", + "canonical": true, + "file": "environments.create_environment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateEnvironment", + "fullName": "google.cloud.dialogflow.v2.Environments.CreateEnvironment", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "environment", + "type": ".google.cloud.dialogflow.v2.Environment" + }, + { + "name": "environment_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Environment", + "client": { + "shortName": "EnvironmentsClient", + "fullName": "google.cloud.dialogflow.v2.EnvironmentsClient" + }, + "method": { + "shortName": "CreateEnvironment", + "fullName": "google.cloud.dialogflow.v2.Environments.CreateEnvironment", + "service": { + "shortName": "Environments", + "fullName": "google.cloud.dialogflow.v2.Environments" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Environments_UpdateEnvironment_async", + "title": "dialogflow updateEnvironment Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "environments.update_environment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateEnvironment", + "fullName": "google.cloud.dialogflow.v2.Environments.UpdateEnvironment", + "async": true, + "parameters": [ + { + "name": "environment", + "type": ".google.cloud.dialogflow.v2.Environment" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "allow_load_to_draft_and_discard_changes", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Environment", + "client": { + "shortName": "EnvironmentsClient", + "fullName": "google.cloud.dialogflow.v2.EnvironmentsClient" + }, + "method": { + "shortName": "UpdateEnvironment", + "fullName": "google.cloud.dialogflow.v2.Environments.UpdateEnvironment", + "service": { + "shortName": "Environments", + "fullName": "google.cloud.dialogflow.v2.Environments" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Environments_DeleteEnvironment_async", + "title": "dialogflow deleteEnvironment Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified agent environment.", + "canonical": true, + "file": "environments.delete_environment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteEnvironment", + "fullName": "google.cloud.dialogflow.v2.Environments.DeleteEnvironment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "EnvironmentsClient", + "fullName": "google.cloud.dialogflow.v2.EnvironmentsClient" + }, + "method": { + "shortName": "DeleteEnvironment", + "fullName": "google.cloud.dialogflow.v2.Environments.DeleteEnvironment", + "service": { + "shortName": "Environments", + "fullName": "google.cloud.dialogflow.v2.Environments" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Environments_GetEnvironmentHistory_async", + "title": "dialogflow getEnvironmentHistory Sample", + "origin": "API_DEFINITION", + "description": " Gets the history of the specified environment.", + "canonical": true, + "file": "environments.get_environment_history.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetEnvironmentHistory", + "fullName": "google.cloud.dialogflow.v2.Environments.GetEnvironmentHistory", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.EnvironmentHistory", + "client": { + "shortName": "EnvironmentsClient", + "fullName": "google.cloud.dialogflow.v2.EnvironmentsClient" + }, + "method": { + "shortName": "GetEnvironmentHistory", + "fullName": "google.cloud.dialogflow.v2.Environments.GetEnvironmentHistory", + "service": { + "shortName": "Environments", + "fullName": "google.cloud.dialogflow.v2.Environments" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Fulfillments_GetFulfillment_async", + "title": "dialogflow getFulfillment Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the fulfillment.", + "canonical": true, + "file": "fulfillments.get_fulfillment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFulfillment", + "fullName": "google.cloud.dialogflow.v2.Fulfillments.GetFulfillment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Fulfillment", + "client": { + "shortName": "FulfillmentsClient", + "fullName": "google.cloud.dialogflow.v2.FulfillmentsClient" + }, + "method": { + "shortName": "GetFulfillment", + "fullName": "google.cloud.dialogflow.v2.Fulfillments.GetFulfillment", + "service": { + "shortName": "Fulfillments", + "fullName": "google.cloud.dialogflow.v2.Fulfillments" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Fulfillments_UpdateFulfillment_async", + "title": "dialogflow updateFulfillment Sample", + "origin": "API_DEFINITION", + "description": " Updates the fulfillment.", + "canonical": true, + "file": "fulfillments.update_fulfillment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFulfillment", + "fullName": "google.cloud.dialogflow.v2.Fulfillments.UpdateFulfillment", + "async": true, + "parameters": [ + { + "name": "fulfillment", + "type": ".google.cloud.dialogflow.v2.Fulfillment" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Fulfillment", + "client": { + "shortName": "FulfillmentsClient", + "fullName": "google.cloud.dialogflow.v2.FulfillmentsClient" + }, + "method": { + "shortName": "UpdateFulfillment", + "fullName": "google.cloud.dialogflow.v2.Fulfillments.UpdateFulfillment", + "service": { + "shortName": "Fulfillments", + "fullName": "google.cloud.dialogflow.v2.Fulfillments" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Intents_ListIntents_async", + "title": "dialogflow listIntents Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all intents in the specified agent.", + "canonical": true, + "file": "intents.list_intents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListIntents", + "fullName": "google.cloud.dialogflow.v2.Intents.ListIntents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "intent_view", + "type": ".google.cloud.dialogflow.v2.IntentView" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListIntentsResponse", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2.IntentsClient" + }, + "method": { + "shortName": "ListIntents", + "fullName": "google.cloud.dialogflow.v2.Intents.ListIntents", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Intents_GetIntent_async", + "title": "dialogflow getIntent Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified intent.", + "canonical": true, + "file": "intents.get_intent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIntent", + "fullName": "google.cloud.dialogflow.v2.Intents.GetIntent", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "intent_view", + "type": ".google.cloud.dialogflow.v2.IntentView" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Intent", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2.IntentsClient" + }, + "method": { + "shortName": "GetIntent", + "fullName": "google.cloud.dialogflow.v2.Intents.GetIntent", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Intents_CreateIntent_async", + "title": "dialogflow createIntent Sample", + "origin": "API_DEFINITION", + "description": " 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).", + "canonical": true, + "file": "intents.create_intent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateIntent", + "fullName": "google.cloud.dialogflow.v2.Intents.CreateIntent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "intent", + "type": ".google.cloud.dialogflow.v2.Intent" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "intent_view", + "type": ".google.cloud.dialogflow.v2.IntentView" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Intent", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2.IntentsClient" + }, + "method": { + "shortName": "CreateIntent", + "fullName": "google.cloud.dialogflow.v2.Intents.CreateIntent", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Intents_UpdateIntent_async", + "title": "dialogflow updateIntent Sample", + "origin": "API_DEFINITION", + "description": " 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).", + "canonical": true, + "file": "intents.update_intent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateIntent", + "fullName": "google.cloud.dialogflow.v2.Intents.UpdateIntent", + "async": true, + "parameters": [ + { + "name": "intent", + "type": ".google.cloud.dialogflow.v2.Intent" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "intent_view", + "type": ".google.cloud.dialogflow.v2.IntentView" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Intent", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2.IntentsClient" + }, + "method": { + "shortName": "UpdateIntent", + "fullName": "google.cloud.dialogflow.v2.Intents.UpdateIntent", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Intents_DeleteIntent_async", + "title": "dialogflow deleteIntent Sample", + "origin": "API_DEFINITION", + "description": " 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).", + "canonical": true, + "file": "intents.delete_intent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteIntent", + "fullName": "google.cloud.dialogflow.v2.Intents.DeleteIntent", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2.IntentsClient" + }, + "method": { + "shortName": "DeleteIntent", + "fullName": "google.cloud.dialogflow.v2.Intents.DeleteIntent", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Intents_BatchUpdateIntents_async", + "title": "dialogflow batchUpdateIntents Sample", + "origin": "API_DEFINITION", + "description": " Updates/Creates multiple intents in the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2.BatchUpdateIntentsResponse] Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "intents.batch_update_intents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 81, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchUpdateIntents", + "fullName": "google.cloud.dialogflow.v2.Intents.BatchUpdateIntents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "intent_batch_uri", + "type": "TYPE_STRING" + }, + { + "name": "intent_batch_inline", + "type": ".google.cloud.dialogflow.v2.IntentBatch" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "intent_view", + "type": ".google.cloud.dialogflow.v2.IntentView" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2.IntentsClient" + }, + "method": { + "shortName": "BatchUpdateIntents", + "fullName": "google.cloud.dialogflow.v2.Intents.BatchUpdateIntents", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Intents_BatchDeleteIntents_async", + "title": "dialogflow batchDeleteIntents Sample", + "origin": "API_DEFINITION", + "description": " Deletes intents in the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "intents.batch_delete_intents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchDeleteIntents", + "fullName": "google.cloud.dialogflow.v2.Intents.BatchDeleteIntents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "intents", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2.IntentsClient" + }, + "method": { + "shortName": "BatchDeleteIntents", + "fullName": "google.cloud.dialogflow.v2.Intents.BatchDeleteIntents", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_KnowledgeBases_ListKnowledgeBases_async", + "title": "dialogflow listKnowledgeBases Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all knowledge bases of the specified agent.", + "canonical": true, + "file": "knowledge_bases.list_knowledge_bases.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 87, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListKnowledgeBases", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.ListKnowledgeBases", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListKnowledgeBasesResponse", + "client": { + "shortName": "KnowledgeBasesClient", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBasesClient" + }, + "method": { + "shortName": "ListKnowledgeBases", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.ListKnowledgeBases", + "service": { + "shortName": "KnowledgeBases", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_KnowledgeBases_GetKnowledgeBase_async", + "title": "dialogflow getKnowledgeBase Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified knowledge base.", + "canonical": true, + "file": "knowledge_bases.get_knowledge_base.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.GetKnowledgeBase", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.KnowledgeBase", + "client": { + "shortName": "KnowledgeBasesClient", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBasesClient" + }, + "method": { + "shortName": "GetKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.GetKnowledgeBase", + "service": { + "shortName": "KnowledgeBases", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_KnowledgeBases_CreateKnowledgeBase_async", + "title": "dialogflow createKnowledgeBase Sample", + "origin": "API_DEFINITION", + "description": " Creates a knowledge base.", + "canonical": true, + "file": "knowledge_bases.create_knowledge_base.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.CreateKnowledgeBase", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "knowledge_base", + "type": ".google.cloud.dialogflow.v2.KnowledgeBase" + } + ], + "resultType": ".google.cloud.dialogflow.v2.KnowledgeBase", + "client": { + "shortName": "KnowledgeBasesClient", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBasesClient" + }, + "method": { + "shortName": "CreateKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.CreateKnowledgeBase", + "service": { + "shortName": "KnowledgeBases", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_KnowledgeBases_DeleteKnowledgeBase_async", + "title": "dialogflow deleteKnowledgeBase Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified knowledge base.", + "canonical": true, + "file": "knowledge_bases.delete_knowledge_base.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.DeleteKnowledgeBase", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "KnowledgeBasesClient", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBasesClient" + }, + "method": { + "shortName": "DeleteKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.DeleteKnowledgeBase", + "service": { + "shortName": "KnowledgeBases", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_KnowledgeBases_UpdateKnowledgeBase_async", + "title": "dialogflow updateKnowledgeBase Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified knowledge base.", + "canonical": true, + "file": "knowledge_bases.update_knowledge_base.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.UpdateKnowledgeBase", + "async": true, + "parameters": [ + { + "name": "knowledge_base", + "type": ".google.cloud.dialogflow.v2.KnowledgeBase" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2.KnowledgeBase", + "client": { + "shortName": "KnowledgeBasesClient", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBasesClient" + }, + "method": { + "shortName": "UpdateKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.UpdateKnowledgeBase", + "service": { + "shortName": "KnowledgeBases", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Participants_CreateParticipant_async", + "title": "dialogflow createParticipant Sample", + "origin": "API_DEFINITION", + "description": " Creates a new participant in a conversation.", + "canonical": true, + "file": "participants.create_participant.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateParticipant", + "fullName": "google.cloud.dialogflow.v2.Participants.CreateParticipant", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "participant", + "type": ".google.cloud.dialogflow.v2.Participant" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Participant", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" + }, + "method": { + "shortName": "CreateParticipant", + "fullName": "google.cloud.dialogflow.v2.Participants.CreateParticipant", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Participants_GetParticipant_async", + "title": "dialogflow getParticipant Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a conversation participant.", + "canonical": true, + "file": "participants.get_participant.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetParticipant", + "fullName": "google.cloud.dialogflow.v2.Participants.GetParticipant", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Participant", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" + }, + "method": { + "shortName": "GetParticipant", + "fullName": "google.cloud.dialogflow.v2.Participants.GetParticipant", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Participants_ListParticipants_async", + "title": "dialogflow listParticipants Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all participants in the specified conversation.", + "canonical": true, + "file": "participants.list_participants.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListParticipants", + "fullName": "google.cloud.dialogflow.v2.Participants.ListParticipants", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListParticipantsResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" + }, + "method": { + "shortName": "ListParticipants", + "fullName": "google.cloud.dialogflow.v2.Participants.ListParticipants", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Participants_UpdateParticipant_async", + "title": "dialogflow updateParticipant Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified participant.", + "canonical": true, + "file": "participants.update_participant.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateParticipant", + "fullName": "google.cloud.dialogflow.v2.Participants.UpdateParticipant", + "async": true, + "parameters": [ + { + "name": "participant", + "type": ".google.cloud.dialogflow.v2.Participant" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Participant", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" + }, + "method": { + "shortName": "UpdateParticipant", + "fullName": "google.cloud.dialogflow.v2.Participants.UpdateParticipant", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Participants_AnalyzeContent_async", + "title": "dialogflow analyzeContent Sample", + "origin": "API_DEFINITION", + "description": " 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).", + "canonical": true, + "file": "participants.analyze_content.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 93, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AnalyzeContent", + "fullName": "google.cloud.dialogflow.v2.Participants.AnalyzeContent", + "async": true, + "parameters": [ + { + "name": "participant", + "type": "TYPE_STRING" + }, + { + "name": "text_input", + "type": ".google.cloud.dialogflow.v2.TextInput" + }, + { + "name": "event_input", + "type": ".google.cloud.dialogflow.v2.EventInput" + }, + { + "name": "reply_audio_config", + "type": ".google.cloud.dialogflow.v2.OutputAudioConfig" + }, + { + "name": "query_params", + "type": ".google.cloud.dialogflow.v2.QueryParameters" + }, + { + "name": "assist_query_params", + "type": ".google.cloud.dialogflow.v2.AssistQueryParameters" + }, + { + "name": "cx_parameters", + "type": ".google.protobuf.Struct" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.AnalyzeContentResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" + }, + "method": { + "shortName": "AnalyzeContent", + "fullName": "google.cloud.dialogflow.v2.Participants.AnalyzeContent", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Participants_StreamingAnalyzeContent_async", + "title": "dialogflow streamingAnalyzeContent Sample", + "origin": "API_DEFINITION", + "description": " Adds a text (chat, for example), or audio (phone recording, for example) message from a participant into the conversation. Note: This method is only available through the gRPC API (not REST). The top-level message sent to the client by the server is `StreamingAnalyzeContentResponse`. Multiple response messages can be returned in order. The first one or more messages contain the `recognition_result` field. Each result represents a more complete transcript of what the user said. The next message contains the `reply_text` field and potentially the `reply_audio` field. The message can also contain the `automated_agent_reply` field. 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).", + "canonical": true, + "file": "participants.streaming_analyze_content.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 117, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StreamingAnalyzeContent", + "fullName": "google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent", + "async": true, + "parameters": [ + { + "name": "participant", + "type": "TYPE_STRING" + }, + { + "name": "audio_config", + "type": ".google.cloud.dialogflow.v2.InputAudioConfig" + }, + { + "name": "text_config", + "type": ".google.cloud.dialogflow.v2.InputTextConfig" + }, + { + "name": "reply_audio_config", + "type": ".google.cloud.dialogflow.v2.OutputAudioConfig" + }, + { + "name": "input_audio", + "type": "TYPE_BYTES" + }, + { + "name": "input_text", + "type": "TYPE_STRING" + }, + { + "name": "input_dtmf", + "type": ".google.cloud.dialogflow.v2.TelephonyDtmfEvents" + }, + { + "name": "query_params", + "type": ".google.cloud.dialogflow.v2.QueryParameters" + }, + { + "name": "assist_query_params", + "type": ".google.cloud.dialogflow.v2.AssistQueryParameters" + }, + { + "name": "cx_parameters", + "type": ".google.protobuf.Struct" + }, + { + "name": "enable_partial_automated_agent_reply", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" + }, + "method": { + "shortName": "StreamingAnalyzeContent", + "fullName": "google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Participants_SuggestArticles_async", + "title": "dialogflow suggestArticles Sample", + "origin": "API_DEFINITION", + "description": " Gets suggested articles for a participant based on specific historical messages.", + "canonical": true, + "file": "participants.suggest_articles.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SuggestArticles", + "fullName": "google.cloud.dialogflow.v2.Participants.SuggestArticles", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "latest_message", + "type": "TYPE_STRING" + }, + { + "name": "context_size", + "type": "TYPE_INT32" + }, + { + "name": "assist_query_params", + "type": ".google.cloud.dialogflow.v2.AssistQueryParameters" + } + ], + "resultType": ".google.cloud.dialogflow.v2.SuggestArticlesResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" + }, + "method": { + "shortName": "SuggestArticles", + "fullName": "google.cloud.dialogflow.v2.Participants.SuggestArticles", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Participants_SuggestFaqAnswers_async", + "title": "dialogflow suggestFaqAnswers Sample", + "origin": "API_DEFINITION", + "description": " Gets suggested faq answers for a participant based on specific historical messages.", + "canonical": true, + "file": "participants.suggest_faq_answers.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SuggestFaqAnswers", + "fullName": "google.cloud.dialogflow.v2.Participants.SuggestFaqAnswers", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "latest_message", + "type": "TYPE_STRING" + }, + { + "name": "context_size", + "type": "TYPE_INT32" + }, + { + "name": "assist_query_params", + "type": ".google.cloud.dialogflow.v2.AssistQueryParameters" + } + ], + "resultType": ".google.cloud.dialogflow.v2.SuggestFaqAnswersResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" + }, + "method": { + "shortName": "SuggestFaqAnswers", + "fullName": "google.cloud.dialogflow.v2.Participants.SuggestFaqAnswers", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Participants_SuggestSmartReplies_async", + "title": "dialogflow suggestSmartReplies Sample", + "origin": "API_DEFINITION", + "description": " Gets smart replies for a participant based on specific historical messages.", + "canonical": true, + "file": "participants.suggest_smart_replies.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SuggestSmartReplies", + "fullName": "google.cloud.dialogflow.v2.Participants.SuggestSmartReplies", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "current_text_input", + "type": ".google.cloud.dialogflow.v2.TextInput" + }, + { + "name": "latest_message", + "type": "TYPE_STRING" + }, + { + "name": "context_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.dialogflow.v2.SuggestSmartRepliesResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" + }, + "method": { + "shortName": "SuggestSmartReplies", + "fullName": "google.cloud.dialogflow.v2.Participants.SuggestSmartReplies", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_SessionEntityTypes_ListSessionEntityTypes_async", + "title": "dialogflow listSessionEntityTypes Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "session_entity_types.list_session_entity_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListSessionEntityTypesResponse", + "client": { + "shortName": "SessionEntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypesClient" + }, + "method": { + "shortName": "ListSessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes", + "service": { + "shortName": "SessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_SessionEntityTypes_GetSessionEntityType_async", + "title": "dialogflow getSessionEntityType Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "session_entity_types.get_session_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSessionEntityType", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.GetSessionEntityType", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.SessionEntityType", + "client": { + "shortName": "SessionEntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypesClient" + }, + "method": { + "shortName": "GetSessionEntityType", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.GetSessionEntityType", + "service": { + "shortName": "SessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_SessionEntityTypes_CreateSessionEntityType_async", + "title": "dialogflow createSessionEntityType Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "session_entity_types.create_session_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSessionEntityType", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.CreateSessionEntityType", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "session_entity_type", + "type": ".google.cloud.dialogflow.v2.SessionEntityType" + } + ], + "resultType": ".google.cloud.dialogflow.v2.SessionEntityType", + "client": { + "shortName": "SessionEntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypesClient" + }, + "method": { + "shortName": "CreateSessionEntityType", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.CreateSessionEntityType", + "service": { + "shortName": "SessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_SessionEntityTypes_UpdateSessionEntityType_async", + "title": "dialogflow updateSessionEntityType Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "session_entity_types.update_session_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSessionEntityType", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.UpdateSessionEntityType", + "async": true, + "parameters": [ + { + "name": "session_entity_type", + "type": ".google.cloud.dialogflow.v2.SessionEntityType" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2.SessionEntityType", + "client": { + "shortName": "SessionEntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypesClient" + }, + "method": { + "shortName": "UpdateSessionEntityType", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.UpdateSessionEntityType", + "service": { + "shortName": "SessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_SessionEntityTypes_DeleteSessionEntityType_async", + "title": "dialogflow deleteSessionEntityType Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "session_entity_types.delete_session_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSessionEntityType", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.DeleteSessionEntityType", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "SessionEntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypesClient" + }, + "method": { + "shortName": "DeleteSessionEntityType", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.DeleteSessionEntityType", + "service": { + "shortName": "SessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Sessions_DetectIntent_async", + "title": "dialogflow detectIntent Sample", + "origin": "API_DEFINITION", + "description": " 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. If you might use [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) or other CCAI products now or in the future, consider using [AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] instead of `DetectIntent`. `AnalyzeContent` has additional functionality for Agent Assist and other CCAI products. Note: Always use agent versions for production traffic. See [Versions and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).", + "canonical": true, + "file": "sessions.detect_intent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 100, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DetectIntent", + "fullName": "google.cloud.dialogflow.v2.Sessions.DetectIntent", + "async": true, + "parameters": [ + { + "name": "session", + "type": "TYPE_STRING" + }, + { + "name": "query_params", + "type": ".google.cloud.dialogflow.v2.QueryParameters" + }, + { + "name": "query_input", + "type": ".google.cloud.dialogflow.v2.QueryInput" + }, + { + "name": "output_audio_config", + "type": ".google.cloud.dialogflow.v2.OutputAudioConfig" + }, + { + "name": "output_audio_config_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "input_audio", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.cloud.dialogflow.v2.DetectIntentResponse", + "client": { + "shortName": "SessionsClient", + "fullName": "google.cloud.dialogflow.v2.SessionsClient" + }, + "method": { + "shortName": "DetectIntent", + "fullName": "google.cloud.dialogflow.v2.Sessions.DetectIntent", + "service": { + "shortName": "Sessions", + "fullName": "google.cloud.dialogflow.v2.Sessions" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Sessions_StreamingDetectIntent_async", + "title": "dialogflow streamingDetectIntent Sample", + "origin": "API_DEFINITION", + "description": " 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). If you might use [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) or other CCAI products now or in the future, consider using [StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent] instead of `StreamingDetectIntent`. `StreamingAnalyzeContent` has additional functionality for Agent Assist and other CCAI products. Note: Always use agent versions for production traffic. See [Versions and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).", + "canonical": true, + "file": "sessions.streaming_detect_intent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 115, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StreamingDetectIntent", + "fullName": "google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent", + "async": true, + "parameters": [ + { + "name": "session", + "type": "TYPE_STRING" + }, + { + "name": "query_params", + "type": ".google.cloud.dialogflow.v2.QueryParameters" + }, + { + "name": "query_input", + "type": ".google.cloud.dialogflow.v2.QueryInput" + }, + { + "name": "single_utterance", + "type": "TYPE_BOOL" + }, + { + "name": "output_audio_config", + "type": ".google.cloud.dialogflow.v2.OutputAudioConfig" + }, + { + "name": "output_audio_config_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "input_audio", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.cloud.dialogflow.v2.StreamingDetectIntentResponse", + "client": { + "shortName": "SessionsClient", + "fullName": "google.cloud.dialogflow.v2.SessionsClient" + }, + "method": { + "shortName": "StreamingDetectIntent", + "fullName": "google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent", + "service": { + "shortName": "Sessions", + "fullName": "google.cloud.dialogflow.v2.Sessions" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Versions_ListVersions_async", + "title": "dialogflow listVersions Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all versions of the specified agent.", + "canonical": true, + "file": "versions.list_versions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListVersions", + "fullName": "google.cloud.dialogflow.v2.Versions.ListVersions", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListVersionsResponse", + "client": { + "shortName": "VersionsClient", + "fullName": "google.cloud.dialogflow.v2.VersionsClient" + }, + "method": { + "shortName": "ListVersions", + "fullName": "google.cloud.dialogflow.v2.Versions.ListVersions", + "service": { + "shortName": "Versions", + "fullName": "google.cloud.dialogflow.v2.Versions" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Versions_GetVersion_async", + "title": "dialogflow getVersion Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified agent version.", + "canonical": true, + "file": "versions.get_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetVersion", + "fullName": "google.cloud.dialogflow.v2.Versions.GetVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Version", + "client": { + "shortName": "VersionsClient", + "fullName": "google.cloud.dialogflow.v2.VersionsClient" + }, + "method": { + "shortName": "GetVersion", + "fullName": "google.cloud.dialogflow.v2.Versions.GetVersion", + "service": { + "shortName": "Versions", + "fullName": "google.cloud.dialogflow.v2.Versions" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Versions_CreateVersion_async", + "title": "dialogflow createVersion Sample", + "origin": "API_DEFINITION", + "description": " Creates an agent version. The new version points to the agent instance in the \"default\" environment.", + "canonical": true, + "file": "versions.create_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateVersion", + "fullName": "google.cloud.dialogflow.v2.Versions.CreateVersion", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "version", + "type": ".google.cloud.dialogflow.v2.Version" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Version", + "client": { + "shortName": "VersionsClient", + "fullName": "google.cloud.dialogflow.v2.VersionsClient" + }, + "method": { + "shortName": "CreateVersion", + "fullName": "google.cloud.dialogflow.v2.Versions.CreateVersion", + "service": { + "shortName": "Versions", + "fullName": "google.cloud.dialogflow.v2.Versions" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Versions_UpdateVersion_async", + "title": "dialogflow updateVersion Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "versions.update_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateVersion", + "fullName": "google.cloud.dialogflow.v2.Versions.UpdateVersion", + "async": true, + "parameters": [ + { + "name": "version", + "type": ".google.cloud.dialogflow.v2.Version" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Version", + "client": { + "shortName": "VersionsClient", + "fullName": "google.cloud.dialogflow.v2.VersionsClient" + }, + "method": { + "shortName": "UpdateVersion", + "fullName": "google.cloud.dialogflow.v2.Versions.UpdateVersion", + "service": { + "shortName": "Versions", + "fullName": "google.cloud.dialogflow.v2.Versions" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Versions_DeleteVersion_async", + "title": "dialogflow deleteVersion Sample", + "origin": "API_DEFINITION", + "description": " Delete the specified agent version.", + "canonical": true, + "file": "versions.delete_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteVersion", + "fullName": "google.cloud.dialogflow.v2.Versions.DeleteVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "VersionsClient", + "fullName": "google.cloud.dialogflow.v2.VersionsClient" + }, + "method": { + "shortName": "DeleteVersion", + "fullName": "google.cloud.dialogflow.v2.Versions.DeleteVersion", + "service": { + "shortName": "Versions", + "fullName": "google.cloud.dialogflow.v2.Versions" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.create_version.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.create_version.js new file mode 100644 index 00000000000..f67e4e95493 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.create_version.js @@ -0,0 +1,69 @@ +// Copyright 2022 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'; + +function main(parent, version) { + // [START dialogflow_v2_generated_Versions_CreateVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to create a version for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Required. The version to create. + */ + // const version = {} + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function callCreateVersion() { + // Construct request + const request = { + parent, + version, + }; + + // Run request + const response = await dialogflowClient.createVersion(request); + console.log(response); + } + + callCreateVersion(); + // [END dialogflow_v2_generated_Versions_CreateVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.delete_version.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.delete_version.js new file mode 100644 index 00000000000..d087ace525f --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.delete_version.js @@ -0,0 +1,65 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_Versions_DeleteVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the version to delete. + * Supported formats: + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function callDeleteVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteVersion(request); + console.log(response); + } + + callDeleteVersion(); + // [END dialogflow_v2_generated_Versions_DeleteVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.get_version.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.get_version.js new file mode 100644 index 00000000000..ad84c7c82ff --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.get_version.js @@ -0,0 +1,65 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2_generated_Versions_GetVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the version. + * Supported formats: + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function callGetVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getVersion(request); + console.log(response); + } + + callGetVersion(); + // [END dialogflow_v2_generated_Versions_GetVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.list_versions.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.list_versions.js new file mode 100644 index 00000000000..15e8e1e850d --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.list_versions.js @@ -0,0 +1,75 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2_generated_Versions_ListVersions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to list all versions from. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function callListVersions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listVersionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListVersions(); + // [END dialogflow_v2_generated_Versions_ListVersions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.update_version.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.update_version.js new file mode 100644 index 00000000000..ee0e78f352a --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.update_version.js @@ -0,0 +1,70 @@ +// Copyright 2022 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'; + +function main(version, updateMask) { + // [START dialogflow_v2_generated_Versions_UpdateVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The version to update. + * Supported formats: + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + */ + // const version = {} + /** + * Required. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function callUpdateVersion() { + // Construct request + const request = { + version, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateVersion(request); + console.log(response); + } + + callUpdateVersion(); + // [END dialogflow_v2_generated_Versions_UpdateVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/index.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/index.ts new file mode 100644 index 00000000000..67bff590c9f --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/index.ts @@ -0,0 +1,57 @@ +// Copyright 2022 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 ConversationDatasetsClient = v2.ConversationDatasetsClient; +type ConversationDatasetsClient = v2.ConversationDatasetsClient; +const ConversationModelsClient = v2.ConversationModelsClient; +type ConversationModelsClient = v2.ConversationModelsClient; +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, ConversationDatasetsClient, ConversationModelsClient, ConversationProfilesClient, ConversationsClient, DocumentsClient, EntityTypesClient, EnvironmentsClient, FulfillmentsClient, IntentsClient, KnowledgeBasesClient, ParticipantsClient, SessionEntityTypesClient, SessionsClient, VersionsClient}; +export default {v2, AgentsClient, AnswerRecordsClient, ContextsClient, ConversationDatasetsClient, ConversationModelsClient, 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/google-cloud-dialogflow/v2/src/v2/agents_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/agents_client.ts new file mode 100644 index 00000000000..672437a3764 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/agents_client.ts @@ -0,0 +1,3664 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +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'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new AgentsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + 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}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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}' + ), + projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2/{name=projects/*/operations/*}:cancel',additional_bindings: [{post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',}], + },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=projects/*/operations/*}',additional_bindings: [{get: '/v2/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2/{name=projects/*}/operations',additional_bindings: [{get: '/v2/{name=projects/*/locations/*}/operations',}], + }]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).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 = this._gaxModule.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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2/agents.get_agent.js + * region_tag:dialogflow_v2_generated_Agents_GetAgent_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.getAgent(request, options, callback); + } +/** + * 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 include:samples/generated/v2/agents.set_agent.js + * region_tag:dialogflow_v2_generated_Agents_SetAgent_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'agent.parent': request.agent!.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.setAgent(request, options, callback); + } +/** + * 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 include:samples/generated/v2/agents.delete_agent.js + * region_tag:dialogflow_v2_generated_Agents_DeleteAgent_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteAgent(request, options, callback); + } +/** + * 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 include:samples/generated/v2/agents.get_validation_result.js + * region_tag:dialogflow_v2_generated_Agents_GetValidationResult_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.getValidationResult(request, options, callback); + } + +/** + * Trains the specified agent. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * 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 include:samples/generated/v2/agents.train_agent.js + * region_tag:dialogflow_v2_generated_Agents_TrainAgent_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2/agents.train_agent.js + * region_tag:dialogflow_v2_generated_Agents_TrainAgent_async + */ + async checkTrainAgentProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.trainAgent, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Exports the specified agent to a ZIP file. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: {@link google.cloud.dialogflow.v2.ExportAgentResponse|ExportAgentResponse} + * + * @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. + * + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2/agents.export_agent.js + * region_tag:dialogflow_v2_generated_Agents_ExportAgent_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2/agents.export_agent.js + * region_tag:dialogflow_v2_generated_Agents_ExportAgent_async + */ + async checkExportAgentProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportAgent, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * 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. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * The operation only tracks when importing is complete, 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://". + * + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @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 include:samples/generated/v2/agents.import_agent.js + * region_tag:dialogflow_v2_generated_Agents_ImportAgent_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2/agents.import_agent.js + * region_tag:dialogflow_v2_generated_Agents_ImportAgent_async + */ + async checkImportAgentProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importAgent, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * 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. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * The operation only tracks when restoring is complete, 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://". + * + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @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 include:samples/generated/v2/agents.restore_agent.js + * region_tag:dialogflow_v2_generated_Agents_RestoreAgent_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2/agents.restore_agent.js + * region_tag:dialogflow_v2_generated_Agents_RestoreAgent_async + */ + async checkRestoreAgentProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.restoreAgent, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['searchAgents']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.searchAgents.createStream( + this.innerApiCalls.searchAgents as 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 include:samples/generated/v2/agents.search_agents.js + * region_tag:dialogflow_v2_generated_Agents_SearchAgents_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['searchAgents']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.searchAgents.asyncIterate( + this.innerApiCalls['searchAgents'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath(project:string,location:string,conversationDataset:string) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; + } + + /** + * 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 projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project:string,conversationModel:string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; + } + + /** + * 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 projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; + } + + /** + * 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 { + if (this.agentsStub && !this._terminated) { + return this.agentsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/agents_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/agents_client_config.json new file mode 100644 index 00000000000..93d6e00d8f9 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/src/v2/agents_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/agents_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/agents_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../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_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/answer_records_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/answer_records_client.ts new file mode 100644 index 00000000000..8f99e13cae2 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/answer_records_client.ts @@ -0,0 +1,2767 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new AnswerRecordsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + 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}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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}' + ), + projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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 = this._gaxModule.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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2/answer_records.update_answer_record.js + * region_tag:dialogflow_v2_generated_AnswerRecords_UpdateAnswerRecord_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'answer_record.name': request.answerRecord!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateAnswerRecord(request, options, callback); + } + + /** + * 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] + * Optional. Filters to restrict results to specific answer records. + * + * Marked deprecated as it hasn't been, and isn't currently, supported. + * + * 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, + 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; + 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' + ] = this._gaxModule.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] + * Optional. Filters to restrict results to specific answer records. + * + * Marked deprecated as it hasn't been, and isn't currently, supported. + * + * 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listAnswerRecords']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAnswerRecords.createStream( + this.innerApiCalls.listAnswerRecords as 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] + * Optional. Filters to restrict results to specific answer records. + * + * Marked deprecated as it hasn't been, and isn't currently, supported. + * + * 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 include:samples/generated/v2/answer_records.list_answer_records.js + * region_tag:dialogflow_v2_generated_AnswerRecords_ListAnswerRecords_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listAnswerRecords']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAnswerRecords.asyncIterate( + this.innerApiCalls['listAnswerRecords'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath(project:string,location:string,conversationDataset:string) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; + } + + /** + * 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 projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project:string,conversationModel:string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; + } + + /** + * 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 projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; + } + + /** + * 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 { + if (this.answerRecordsStub && !this._terminated) { + return this.answerRecordsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/answer_records_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/answer_records_client_config.json new file mode 100644 index 00000000000..cc29e1ea884 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/src/v2/answer_records_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/answer_records_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/answer_records_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../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_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/contexts_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/contexts_client.ts new file mode 100644 index 00000000000..949503b0f12 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/contexts_client.ts @@ -0,0 +1,3089 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ContextsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + 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}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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}' + ), + projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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 = this._gaxModule.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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2/contexts.get_context.js + * region_tag:dialogflow_v2_generated_Contexts_GetContext_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getContext(request, options, callback); + } +/** + * 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 include:samples/generated/v2/contexts.create_context.js + * region_tag:dialogflow_v2_generated_Contexts_CreateContext_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createContext(request, options, callback); + } +/** + * 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 include:samples/generated/v2/contexts.update_context.js + * region_tag:dialogflow_v2_generated_Contexts_UpdateContext_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'context.name': request.context!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateContext(request, options, callback); + } +/** + * Deletes the specified context. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the context to delete. Format: + * `projects//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 include:samples/generated/v2/contexts.delete_context.js + * region_tag:dialogflow_v2_generated_Contexts_DeleteContext_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteContext(request, options, callback); + } +/** + * Deletes all active contexts in the specified session. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the session to delete all contexts from. Format: + * `projects//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 include:samples/generated/v2/contexts.delete_all_contexts.js + * region_tag:dialogflow_v2_generated_Contexts_DeleteAllContexts_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteAllContexts(request, options, callback); + } + + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listContexts']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listContexts.createStream( + this.innerApiCalls.listContexts as 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 include:samples/generated/v2/contexts.list_contexts.js + * region_tag:dialogflow_v2_generated_Contexts_ListContexts_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listContexts']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listContexts.asyncIterate( + this.innerApiCalls['listContexts'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath(project:string,location:string,conversationDataset:string) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; + } + + /** + * 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 projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project:string,conversationModel:string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; + } + + /** + * 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 projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; + } + + /** + * 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 { + if (this.contextsStub && !this._terminated) { + return this.contextsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/contexts_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/contexts_client_config.json new file mode 100644 index 00000000000..c44e6aaa4fb --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/src/v2/contexts_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/contexts_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/contexts_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../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_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/conversation_datasets_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_datasets_client.ts new file mode 100644 index 00000000000..2b77045bdb4 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_datasets_client.ts @@ -0,0 +1,3303 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/conversation_datasets_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './conversation_datasets_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Conversation datasets. + * + * Conversation datasets contain raw conversation files and their + * customizable metadata that can be used for model training. + * @class + * @memberof v2 + */ +export class ConversationDatasetsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + conversationDatasetsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ConversationDatasetsClient. + * + * @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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ConversationDatasetsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ConversationDatasetsClient; + 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + 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}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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}' + ), + projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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 = { + listConversationDatasets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'conversationDatasets') + }; + + 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. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2/{name=projects/*/operations/*}:cancel',additional_bindings: [{post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',}], + },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=projects/*/operations/*}',additional_bindings: [{get: '/v2/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2/{name=projects/*}/operations',additional_bindings: [{get: '/v2/{name=projects/*/locations/*}/operations',}], + }]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createConversationDatasetResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.ConversationDataset') as gax.protobuf.Type; + const createConversationDatasetMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata') as gax.protobuf.Type; + const deleteConversationDatasetResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteConversationDatasetMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata') as gax.protobuf.Type; + const importConversationDataResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.ImportConversationDataOperationResponse') as gax.protobuf.Type; + const importConversationDataMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createConversationDataset: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createConversationDatasetResponse.decode.bind(createConversationDatasetResponse), + createConversationDatasetMetadata.decode.bind(createConversationDatasetMetadata)), + deleteConversationDataset: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteConversationDatasetResponse.decode.bind(deleteConversationDatasetResponse), + deleteConversationDatasetMetadata.decode.bind(deleteConversationDatasetMetadata)), + importConversationData: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importConversationDataResponse.decode.bind(importConversationDataResponse), + importConversationDataMetadata.decode.bind(importConversationDataMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.ConversationDatasets', 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 = this._gaxModule.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.conversationDatasetsStub) { + return this.conversationDatasetsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.ConversationDatasets. + this.conversationDatasetsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.ConversationDatasets') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.ConversationDatasets, + 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 conversationDatasetsStubMethods = + ['createConversationDataset', 'getConversationDataset', 'listConversationDatasets', 'deleteConversationDataset', 'importConversationData']; + for (const methodName of conversationDatasetsStubMethods) { + const callPromise = this.conversationDatasetsStub.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._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.conversationDatasetsStub; + } + + /** + * 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 -- + // ------------------- +/** + * Retrieves the specified conversation dataset. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The conversation dataset to retrieve. Format: + * `projects//locations//conversationDatasets/` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ConversationDataset]{@link google.cloud.dialogflow.v2.ConversationDataset}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/conversation_datasets.get_conversation_dataset.js + * region_tag:dialogflow_v2_generated_ConversationDatasets_GetConversationDataset_async + */ + getConversationDataset( + request?: protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversationDataset, + protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest|undefined, {}|undefined + ]>; + getConversationDataset( + request: protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversationDataset, + protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest|null|undefined, + {}|null|undefined>): void; + getConversationDataset( + request: protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversationDataset, + protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest|null|undefined, + {}|null|undefined>): void; + getConversationDataset( + request?: protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IConversationDataset, + protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IConversationDataset, + protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversationDataset, + protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getConversationDataset(request, options, callback); + } + +/** + * Creates a new conversation dataset. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata|CreateConversationDatasetOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2.ConversationDataset|ConversationDataset} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to create conversation dataset for. Format: + * `projects//locations/` + * @param {google.cloud.dialogflow.v2.ConversationDataset} request.conversationDataset + * Required. The conversation dataset 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 include:samples/generated/v2/conversation_datasets.create_conversation_dataset.js + * region_tag:dialogflow_v2_generated_ConversationDatasets_CreateConversationDataset_async + */ + createConversationDataset( + request?: protos.google.cloud.dialogflow.v2.ICreateConversationDatasetRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createConversationDataset( + request: protos.google.cloud.dialogflow.v2.ICreateConversationDatasetRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createConversationDataset( + request: protos.google.cloud.dialogflow.v2.ICreateConversationDatasetRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createConversationDataset( + request?: protos.google.cloud.dialogflow.v2.ICreateConversationDatasetRequest, + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createConversationDataset(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createConversationDataset()`. + * @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 include:samples/generated/v2/conversation_datasets.create_conversation_dataset.js + * region_tag:dialogflow_v2_generated_ConversationDatasets_CreateConversationDataset_async + */ + async checkCreateConversationDatasetProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createConversationDataset, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes the specified conversation dataset. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata|DeleteConversationDatasetOperationMetadata} + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The conversation dataset to delete. Format: + * `projects//locations//conversationDatasets/` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2/conversation_datasets.delete_conversation_dataset.js + * region_tag:dialogflow_v2_generated_ConversationDatasets_DeleteConversationDataset_async + */ + deleteConversationDataset( + request?: protos.google.cloud.dialogflow.v2.IDeleteConversationDatasetRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteConversationDataset( + request: protos.google.cloud.dialogflow.v2.IDeleteConversationDatasetRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteConversationDataset( + request: protos.google.cloud.dialogflow.v2.IDeleteConversationDatasetRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteConversationDataset( + request?: protos.google.cloud.dialogflow.v2.IDeleteConversationDatasetRequest, + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteConversationDataset(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteConversationDataset()`. + * @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 include:samples/generated/v2/conversation_datasets.delete_conversation_dataset.js + * region_tag:dialogflow_v2_generated_ConversationDatasets_DeleteConversationDataset_async + */ + async checkDeleteConversationDatasetProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteConversationDataset, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Import data into the specified conversation dataset. Note that it + * is not allowed to import data to a conversation dataset that + * already has data in it. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata|ImportConversationDataOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2.ImportConversationDataOperationResponse|ImportConversationDataOperationResponse} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Dataset resource name. Format: + * `projects//locations//conversationDatasets/` + * @param {google.cloud.dialogflow.v2.InputConfig} request.inputConfig + * Required. Configuration describing where to import data from. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2/conversation_datasets.import_conversation_data.js + * region_tag:dialogflow_v2_generated_ConversationDatasets_ImportConversationData_async + */ + importConversationData( + request?: protos.google.cloud.dialogflow.v2.IImportConversationDataRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + importConversationData( + request: protos.google.cloud.dialogflow.v2.IImportConversationDataRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + importConversationData( + request: protos.google.cloud.dialogflow.v2.IImportConversationDataRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + importConversationData( + request?: protos.google.cloud.dialogflow.v2.IImportConversationDataRequest, + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.importConversationData(request, options, callback); + } +/** + * Check the status of the long running operation returned by `importConversationData()`. + * @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 include:samples/generated/v2/conversation_datasets.import_conversation_data.js + * region_tag:dialogflow_v2_generated_ConversationDatasets_ImportConversationData_async + */ + async checkImportConversationDataProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importConversationData, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Returns the list of all conversation datasets in the specified + * project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location name to list all conversation datasets for. + * Format: `projects//locations/` + * @param {number} [request.pageSize] + * Optional. Maximum number of conversation datasets 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 [ConversationDataset]{@link google.cloud.dialogflow.v2.ConversationDataset}. + * 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 `listConversationDatasetsAsync()` + * 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. + */ + listConversationDatasets( + request?: protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversationDataset[], + protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest|null, + protos.google.cloud.dialogflow.v2.IListConversationDatasetsResponse + ]>; + listConversationDatasets( + request: protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, + protos.google.cloud.dialogflow.v2.IListConversationDatasetsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IConversationDataset>): void; + listConversationDatasets( + request: protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, + protos.google.cloud.dialogflow.v2.IListConversationDatasetsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IConversationDataset>): void; + listConversationDatasets( + request?: protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, + protos.google.cloud.dialogflow.v2.IListConversationDatasetsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IConversationDataset>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, + protos.google.cloud.dialogflow.v2.IListConversationDatasetsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IConversationDataset>): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversationDataset[], + protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest|null, + protos.google.cloud.dialogflow.v2.IListConversationDatasetsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listConversationDatasets(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 and location name to list all conversation datasets for. + * Format: `projects//locations/` + * @param {number} [request.pageSize] + * Optional. Maximum number of conversation datasets 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 [ConversationDataset]{@link google.cloud.dialogflow.v2.ConversationDataset} 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 `listConversationDatasetsAsync()` + * 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. + */ + listConversationDatasetsStream( + request?: protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listConversationDatasets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversationDatasets.createStream( + this.innerApiCalls.listConversationDatasets as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listConversationDatasets`, 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 and location name to list all conversation datasets for. + * Format: `projects//locations/` + * @param {number} [request.pageSize] + * Optional. Maximum number of conversation datasets 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 + * [ConversationDataset]{@link google.cloud.dialogflow.v2.ConversationDataset}. 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 include:samples/generated/v2/conversation_datasets.list_conversation_datasets.js + * region_tag:dialogflow_v2_generated_ConversationDatasets_ListConversationDatasets_async + */ + listConversationDatasetsAsync( + request?: protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listConversationDatasets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversationDatasets.asyncIterate( + this.innerApiCalls['listConversationDatasets'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath(project:string,location:string,conversationDataset:string) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * 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 projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project:string,conversationModel:string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; + } + + /** + * 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 projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; + } + + /** + * 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 { + if (this.conversationDatasetsStub && !this._terminated) { + return this.conversationDatasetsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_datasets_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_datasets_client_config.json new file mode 100644 index 00000000000..6553edd4445 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_datasets_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.ConversationDatasets": { + "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": { + "CreateConversationDataset": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetConversationDataset": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListConversationDatasets": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteConversationDataset": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ImportConversationData": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_datasets_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_datasets_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_datasets_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../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_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/conversation_models_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_models_client.ts new file mode 100644 index 00000000000..6fb8405d2d7 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_models_client.ts @@ -0,0 +1,3725 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/conversation_models_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './conversation_models_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Manages a collection of models for human agent assistant. + * @class + * @memberof v2 + */ +export class ConversationModelsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + conversationModelsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ConversationModelsClient. + * + * @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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ConversationModelsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ConversationModelsClient; + 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + 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}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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}' + ), + projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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 = { + listConversationModels: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'conversationModels'), + listConversationModelEvaluations: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'conversationModelEvaluations') + }; + + 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. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2/{name=projects/*/operations/*}:cancel',additional_bindings: [{post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',}], + },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=projects/*/operations/*}',additional_bindings: [{get: '/v2/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2/{name=projects/*}/operations',additional_bindings: [{get: '/v2/{name=projects/*/locations/*}/operations',}], + }]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createConversationModelResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.ConversationModel') as gax.protobuf.Type; + const createConversationModelMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata') as gax.protobuf.Type; + const deleteConversationModelResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteConversationModelMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata') as gax.protobuf.Type; + const deployConversationModelResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deployConversationModelMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata') as gax.protobuf.Type; + const undeployConversationModelResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const undeployConversationModelMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata') as gax.protobuf.Type; + const createConversationModelEvaluationResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.ConversationModelEvaluation') as gax.protobuf.Type; + const createConversationModelEvaluationMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createConversationModel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createConversationModelResponse.decode.bind(createConversationModelResponse), + createConversationModelMetadata.decode.bind(createConversationModelMetadata)), + deleteConversationModel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteConversationModelResponse.decode.bind(deleteConversationModelResponse), + deleteConversationModelMetadata.decode.bind(deleteConversationModelMetadata)), + deployConversationModel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deployConversationModelResponse.decode.bind(deployConversationModelResponse), + deployConversationModelMetadata.decode.bind(deployConversationModelMetadata)), + undeployConversationModel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + undeployConversationModelResponse.decode.bind(undeployConversationModelResponse), + undeployConversationModelMetadata.decode.bind(undeployConversationModelMetadata)), + createConversationModelEvaluation: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createConversationModelEvaluationResponse.decode.bind(createConversationModelEvaluationResponse), + createConversationModelEvaluationMetadata.decode.bind(createConversationModelEvaluationMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.ConversationModels', 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 = this._gaxModule.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.conversationModelsStub) { + return this.conversationModelsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.ConversationModels. + this.conversationModelsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.ConversationModels') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.ConversationModels, + 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 conversationModelsStubMethods = + ['createConversationModel', 'getConversationModel', 'listConversationModels', 'deleteConversationModel', 'deployConversationModel', 'undeployConversationModel', 'getConversationModelEvaluation', 'listConversationModelEvaluations', 'createConversationModelEvaluation']; + for (const methodName of conversationModelsStubMethods) { + const callPromise = this.conversationModelsStub.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._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.conversationModelsStub; + } + + /** + * 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 -- + // ------------------- +/** + * Gets conversation model. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The conversation model to retrieve. Format: + * `projects//conversationModels/` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ConversationModel]{@link google.cloud.dialogflow.v2.ConversationModel}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/conversation_models.get_conversation_model.js + * region_tag:dialogflow_v2_generated_ConversationModels_GetConversationModel_async + */ + getConversationModel( + request?: protos.google.cloud.dialogflow.v2.IGetConversationModelRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversationModel, + protos.google.cloud.dialogflow.v2.IGetConversationModelRequest|undefined, {}|undefined + ]>; + getConversationModel( + request: protos.google.cloud.dialogflow.v2.IGetConversationModelRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversationModel, + protos.google.cloud.dialogflow.v2.IGetConversationModelRequest|null|undefined, + {}|null|undefined>): void; + getConversationModel( + request: protos.google.cloud.dialogflow.v2.IGetConversationModelRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversationModel, + protos.google.cloud.dialogflow.v2.IGetConversationModelRequest|null|undefined, + {}|null|undefined>): void; + getConversationModel( + request?: protos.google.cloud.dialogflow.v2.IGetConversationModelRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IConversationModel, + protos.google.cloud.dialogflow.v2.IGetConversationModelRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IConversationModel, + protos.google.cloud.dialogflow.v2.IGetConversationModelRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversationModel, + protos.google.cloud.dialogflow.v2.IGetConversationModelRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getConversationModel(request, options, callback); + } +/** + * Gets an evaluation of conversation model. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The conversation model evaluation resource name. Format: + * `projects//conversationModels//evaluations/` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ConversationModelEvaluation]{@link google.cloud.dialogflow.v2.ConversationModelEvaluation}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/conversation_models.get_conversation_model_evaluation.js + * region_tag:dialogflow_v2_generated_ConversationModels_GetConversationModelEvaluation_async + */ + getConversationModelEvaluation( + request?: protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, + protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest|undefined, {}|undefined + ]>; + getConversationModelEvaluation( + request: protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, + protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest|null|undefined, + {}|null|undefined>): void; + getConversationModelEvaluation( + request: protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, + protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest|null|undefined, + {}|null|undefined>): void; + getConversationModelEvaluation( + request?: protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, + protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, + protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, + protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getConversationModelEvaluation(request, options, callback); + } + +/** + * Creates a model. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata|CreateConversationModelOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2.ConversationModel|ConversationModel} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The project to create conversation model for. Format: + * `projects/` + * @param {google.cloud.dialogflow.v2.ConversationModel} request.conversationModel + * Required. The conversation model 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 include:samples/generated/v2/conversation_models.create_conversation_model.js + * region_tag:dialogflow_v2_generated_ConversationModels_CreateConversationModel_async + */ + createConversationModel( + request?: protos.google.cloud.dialogflow.v2.ICreateConversationModelRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createConversationModel( + request: protos.google.cloud.dialogflow.v2.ICreateConversationModelRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createConversationModel( + request: protos.google.cloud.dialogflow.v2.ICreateConversationModelRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createConversationModel( + request?: protos.google.cloud.dialogflow.v2.ICreateConversationModelRequest, + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createConversationModel(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createConversationModel()`. + * @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 include:samples/generated/v2/conversation_models.create_conversation_model.js + * region_tag:dialogflow_v2_generated_ConversationModels_CreateConversationModel_async + */ + async checkCreateConversationModelProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createConversationModel, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a model. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata|DeleteConversationModelOperationMetadata} + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The conversation model to delete. Format: + * `projects//conversationModels/` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2/conversation_models.delete_conversation_model.js + * region_tag:dialogflow_v2_generated_ConversationModels_DeleteConversationModel_async + */ + deleteConversationModel( + request?: protos.google.cloud.dialogflow.v2.IDeleteConversationModelRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteConversationModel( + request: protos.google.cloud.dialogflow.v2.IDeleteConversationModelRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteConversationModel( + request: protos.google.cloud.dialogflow.v2.IDeleteConversationModelRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteConversationModel( + request?: protos.google.cloud.dialogflow.v2.IDeleteConversationModelRequest, + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteConversationModel(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteConversationModel()`. + * @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 include:samples/generated/v2/conversation_models.delete_conversation_model.js + * region_tag:dialogflow_v2_generated_ConversationModels_DeleteConversationModel_async + */ + async checkDeleteConversationModelProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteConversationModel, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deploys a model. If a model is already deployed, deploying it + * has no effect. A model can only serve prediction requests after it gets + * deployed. For article suggestion, custom model will not be used unless + * it is deployed. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata|DeployConversationModelOperationMetadata} + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The conversation model to deploy. Format: + * `projects//conversationModels/` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2/conversation_models.deploy_conversation_model.js + * region_tag:dialogflow_v2_generated_ConversationModels_DeployConversationModel_async + */ + deployConversationModel( + request?: protos.google.cloud.dialogflow.v2.IDeployConversationModelRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deployConversationModel( + request: protos.google.cloud.dialogflow.v2.IDeployConversationModelRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deployConversationModel( + request: protos.google.cloud.dialogflow.v2.IDeployConversationModelRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deployConversationModel( + request?: protos.google.cloud.dialogflow.v2.IDeployConversationModelRequest, + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deployConversationModel(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deployConversationModel()`. + * @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 include:samples/generated/v2/conversation_models.deploy_conversation_model.js + * region_tag:dialogflow_v2_generated_ConversationModels_DeployConversationModel_async + */ + async checkDeployConversationModelProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deployConversationModel, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Undeploys a model. If the model is not deployed this method has no effect. + * If the model is currently being used: + * - For article suggestion, article suggestion will fallback to the default + * model if model is undeployed. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata|UndeployConversationModelOperationMetadata} + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The conversation model to undeploy. Format: + * `projects//conversationModels/` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2/conversation_models.undeploy_conversation_model.js + * region_tag:dialogflow_v2_generated_ConversationModels_UndeployConversationModel_async + */ + undeployConversationModel( + request?: protos.google.cloud.dialogflow.v2.IUndeployConversationModelRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + undeployConversationModel( + request: protos.google.cloud.dialogflow.v2.IUndeployConversationModelRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + undeployConversationModel( + request: protos.google.cloud.dialogflow.v2.IUndeployConversationModelRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + undeployConversationModel( + request?: protos.google.cloud.dialogflow.v2.IUndeployConversationModelRequest, + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.undeployConversationModel(request, options, callback); + } +/** + * Check the status of the long running operation returned by `undeployConversationModel()`. + * @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 include:samples/generated/v2/conversation_models.undeploy_conversation_model.js + * region_tag:dialogflow_v2_generated_ConversationModels_UndeployConversationModel_async + */ + async checkUndeployConversationModelProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.undeployConversationModel, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates evaluation of a conversation model. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The conversation model resource name. Format: + * `projects//locations//conversationModels/` + * @param {google.cloud.dialogflow.v2.ConversationModelEvaluation} request.conversationModelEvaluation + * Required. The conversation model evaluation to be created. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2/conversation_models.create_conversation_model_evaluation.js + * region_tag:dialogflow_v2_generated_ConversationModels_CreateConversationModelEvaluation_async + */ + createConversationModelEvaluation( + request?: protos.google.cloud.dialogflow.v2.ICreateConversationModelEvaluationRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createConversationModelEvaluation( + request: protos.google.cloud.dialogflow.v2.ICreateConversationModelEvaluationRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createConversationModelEvaluation( + request: protos.google.cloud.dialogflow.v2.ICreateConversationModelEvaluationRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createConversationModelEvaluation( + request?: protos.google.cloud.dialogflow.v2.ICreateConversationModelEvaluationRequest, + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createConversationModelEvaluation(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createConversationModelEvaluation()`. + * @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 include:samples/generated/v2/conversation_models.create_conversation_model_evaluation.js + * region_tag:dialogflow_v2_generated_ConversationModels_CreateConversationModelEvaluation_async + */ + async checkCreateConversationModelEvaluationProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createConversationModelEvaluation, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists conversation models. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list all conversation models for. + * Format: `projects/` + * @param {number} [request.pageSize] + * Optional. Maximum number of conversation models 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 [ConversationModel]{@link google.cloud.dialogflow.v2.ConversationModel}. + * 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 `listConversationModelsAsync()` + * 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. + */ + listConversationModels( + request?: protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversationModel[], + protos.google.cloud.dialogflow.v2.IListConversationModelsRequest|null, + protos.google.cloud.dialogflow.v2.IListConversationModelsResponse + ]>; + listConversationModels( + request: protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, + protos.google.cloud.dialogflow.v2.IListConversationModelsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IConversationModel>): void; + listConversationModels( + request: protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, + protos.google.cloud.dialogflow.v2.IListConversationModelsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IConversationModel>): void; + listConversationModels( + request?: protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, + protos.google.cloud.dialogflow.v2.IListConversationModelsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IConversationModel>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, + protos.google.cloud.dialogflow.v2.IListConversationModelsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IConversationModel>): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversationModel[], + protos.google.cloud.dialogflow.v2.IListConversationModelsRequest|null, + protos.google.cloud.dialogflow.v2.IListConversationModelsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listConversationModels(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 models for. + * Format: `projects/` + * @param {number} [request.pageSize] + * Optional. Maximum number of conversation models 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 [ConversationModel]{@link google.cloud.dialogflow.v2.ConversationModel} 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 `listConversationModelsAsync()` + * 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. + */ + listConversationModelsStream( + request?: protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listConversationModels']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversationModels.createStream( + this.innerApiCalls.listConversationModels as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listConversationModels`, 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 models for. + * Format: `projects/` + * @param {number} [request.pageSize] + * Optional. Maximum number of conversation models 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 + * [ConversationModel]{@link google.cloud.dialogflow.v2.ConversationModel}. 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 include:samples/generated/v2/conversation_models.list_conversation_models.js + * region_tag:dialogflow_v2_generated_ConversationModels_ListConversationModels_async + */ + listConversationModelsAsync( + request?: protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listConversationModels']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversationModels.asyncIterate( + this.innerApiCalls['listConversationModels'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists evaluations of a conversation model. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The conversation model resource name. Format: + * `projects//conversationModels/` + * @param {number} [request.pageSize] + * Optional. Maximum number of evaluations 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 [ConversationModelEvaluation]{@link google.cloud.dialogflow.v2.ConversationModelEvaluation}. + * 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 `listConversationModelEvaluationsAsync()` + * 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. + */ + listConversationModelEvaluations( + request?: protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation[], + protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest|null, + protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse + ]>; + listConversationModelEvaluations( + request: protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, + protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation>): void; + listConversationModelEvaluations( + request: protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, + protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation>): void; + listConversationModelEvaluations( + request?: protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, + protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation>, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, + protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse|null|undefined, + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation>): + Promise<[ + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation[], + protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest|null, + protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listConversationModelEvaluations(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 model resource name. Format: + * `projects//conversationModels/` + * @param {number} [request.pageSize] + * Optional. Maximum number of evaluations 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 [ConversationModelEvaluation]{@link google.cloud.dialogflow.v2.ConversationModelEvaluation} 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 `listConversationModelEvaluationsAsync()` + * 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. + */ + listConversationModelEvaluationsStream( + request?: protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listConversationModelEvaluations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversationModelEvaluations.createStream( + this.innerApiCalls.listConversationModelEvaluations as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listConversationModelEvaluations`, 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 model resource name. Format: + * `projects//conversationModels/` + * @param {number} [request.pageSize] + * Optional. Maximum number of evaluations 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 + * [ConversationModelEvaluation]{@link google.cloud.dialogflow.v2.ConversationModelEvaluation}. 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 include:samples/generated/v2/conversation_models.list_conversation_model_evaluations.js + * region_tag:dialogflow_v2_generated_ConversationModels_ListConversationModelEvaluations_async + */ + listConversationModelEvaluationsAsync( + request?: protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listConversationModelEvaluations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversationModelEvaluations.asyncIterate( + this.innerApiCalls['listConversationModelEvaluations'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath(project:string,location:string,conversationDataset:string) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; + } + + /** + * 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 projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project:string,conversationModel:string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; + } + + /** + * 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 projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; + } + + /** + * 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 { + if (this.conversationModelsStub && !this._terminated) { + return this.conversationModelsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_models_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_models_client_config.json new file mode 100644 index 00000000000..8f65b8621ef --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_models_client_config.json @@ -0,0 +1,74 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.ConversationModels": { + "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": { + "CreateConversationModel": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetConversationModel": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListConversationModels": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteConversationModel": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeployConversationModel": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UndeployConversationModel": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetConversationModelEvaluation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListConversationModelEvaluations": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateConversationModelEvaluation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_models_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_models_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_models_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../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_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/conversation_profiles_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_profiles_client.ts new file mode 100644 index 00000000000..74acd19128e --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_profiles_client.ts @@ -0,0 +1,3445 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ConversationProfilesClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = { + cXSecuritySettingsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securitySettings/{security_settings}' + ), + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + 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}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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}' + ), + projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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') + }; + + 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. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2/{name=projects/*/operations/*}:cancel',additional_bindings: [{post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',}], + },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=projects/*/operations/*}',additional_bindings: [{get: '/v2/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2/{name=projects/*}/operations',additional_bindings: [{get: '/v2/{name=projects/*/locations/*}/operations',}], + }]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const setSuggestionFeatureConfigResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.ConversationProfile') as gax.protobuf.Type; + const setSuggestionFeatureConfigMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata') as gax.protobuf.Type; + const clearSuggestionFeatureConfigResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.ConversationProfile') as gax.protobuf.Type; + const clearSuggestionFeatureConfigMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + setSuggestionFeatureConfig: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + setSuggestionFeatureConfigResponse.decode.bind(setSuggestionFeatureConfigResponse), + setSuggestionFeatureConfigMetadata.decode.bind(setSuggestionFeatureConfigMetadata)), + clearSuggestionFeatureConfig: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + clearSuggestionFeatureConfigResponse.decode.bind(clearSuggestionFeatureConfigResponse), + clearSuggestionFeatureConfigMetadata.decode.bind(clearSuggestionFeatureConfigMetadata)) + }; + + // 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 = this._gaxModule.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', 'setSuggestionFeatureConfig', 'clearSuggestionFeatureConfig']; + 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] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2/conversation_profiles.get_conversation_profile.js + * region_tag:dialogflow_v2_generated_ConversationProfiles_GetConversationProfile_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getConversationProfile(request, options, callback); + } +/** + * 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 include:samples/generated/v2/conversation_profiles.create_conversation_profile.js + * region_tag:dialogflow_v2_generated_ConversationProfiles_CreateConversationProfile_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createConversationProfile(request, options, callback); + } +/** + * 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 include:samples/generated/v2/conversation_profiles.update_conversation_profile.js + * region_tag:dialogflow_v2_generated_ConversationProfiles_UpdateConversationProfile_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'conversation_profile.name': request.conversationProfile!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateConversationProfile(request, options, callback); + } +/** + * 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 include:samples/generated/v2/conversation_profiles.delete_conversation_profile.js + * region_tag:dialogflow_v2_generated_ConversationProfiles_DeleteConversationProfile_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteConversationProfile(request, options, callback); + } + +/** + * Adds or updates a suggestion feature in a conversation profile. + * If the conversation profile contains the type of suggestion feature for + * the participant role, it will update it. Otherwise it will insert the + * suggestion feature. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata|SetSuggestionFeatureConfigOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2.ConversationProfile|ConversationProfile} + * + * If a long running operation to add or update suggestion feature + * config for the same conversation profile, participant role and suggestion + * feature type exists, please cancel the existing long running operation + * before sending such request, otherwise the request will be rejected. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.conversationProfile + * Required. The Conversation Profile to add or update the suggestion feature + * config. Format: `projects//locations//conversationProfiles/`. + * @param {google.cloud.dialogflow.v2.Participant.Role} request.participantRole + * Required. The participant role to add or update the suggestion feature + * config. Only HUMAN_AGENT or END_USER can be used. + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig} request.suggestionFeatureConfig + * Required. The suggestion feature config to add or 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 + * 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 include:samples/generated/v2/conversation_profiles.set_suggestion_feature_config.js + * region_tag:dialogflow_v2_generated_ConversationProfiles_SetSuggestionFeatureConfig_async + */ + setSuggestionFeatureConfig( + request?: protos.google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + setSuggestionFeatureConfig( + request: protos.google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + setSuggestionFeatureConfig( + request: protos.google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + setSuggestionFeatureConfig( + request?: protos.google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigRequest, + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'conversation_profile': request.conversationProfile ?? '', + }); + this.initialize(); + return this.innerApiCalls.setSuggestionFeatureConfig(request, options, callback); + } +/** + * Check the status of the long running operation returned by `setSuggestionFeatureConfig()`. + * @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 include:samples/generated/v2/conversation_profiles.set_suggestion_feature_config.js + * region_tag:dialogflow_v2_generated_ConversationProfiles_SetSuggestionFeatureConfig_async + */ + async checkSetSuggestionFeatureConfigProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.setSuggestionFeatureConfig, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Clears a suggestion feature from a conversation profile for the given + * participant role. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata|ClearSuggestionFeatureConfigOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2.ConversationProfile|ConversationProfile} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.conversationProfile + * Required. The Conversation Profile to add or update the suggestion feature + * config. Format: `projects//locations//conversationProfiles/`. + * @param {google.cloud.dialogflow.v2.Participant.Role} request.participantRole + * Required. The participant role to remove the suggestion feature + * config. Only HUMAN_AGENT or END_USER can be used. + * @param {google.cloud.dialogflow.v2.SuggestionFeature.Type} request.suggestionFeatureType + * Required. The type of the suggestion feature to remove. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2/conversation_profiles.clear_suggestion_feature_config.js + * region_tag:dialogflow_v2_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async + */ + clearSuggestionFeatureConfig( + request?: protos.google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + clearSuggestionFeatureConfig( + request: protos.google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + clearSuggestionFeatureConfig( + request: protos.google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + clearSuggestionFeatureConfig( + request?: protos.google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigRequest, + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'conversation_profile': request.conversationProfile ?? '', + }); + this.initialize(); + return this.innerApiCalls.clearSuggestionFeatureConfig(request, options, callback); + } +/** + * Check the status of the long running operation returned by `clearSuggestionFeatureConfig()`. + * @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 include:samples/generated/v2/conversation_profiles.clear_suggestion_feature_config.js + * region_tag:dialogflow_v2_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async + */ + async checkClearSuggestionFeatureConfigProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.clearSuggestionFeatureConfig, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listConversationProfiles']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversationProfiles.createStream( + this.innerApiCalls.listConversationProfiles as 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 include:samples/generated/v2/conversation_profiles.list_conversation_profiles.js + * region_tag:dialogflow_v2_generated_ConversationProfiles_ListConversationProfiles_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listConversationProfiles']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversationProfiles.asyncIterate( + this.innerApiCalls['listConversationProfiles'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified cXSecuritySettings resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} security_settings + * @returns {string} Resource name string. + */ + cXSecuritySettingsPath(project:string,location:string,securitySettings:string) { + return this.pathTemplates.cXSecuritySettingsPathTemplate.render({ + project: project, + location: location, + security_settings: securitySettings, + }); + } + + /** + * Parse the project from CXSecuritySettings resource. + * + * @param {string} cXSecuritySettingsName + * A fully-qualified path representing CXSecuritySettings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCXSecuritySettingsName(cXSecuritySettingsName: string) { + return this.pathTemplates.cXSecuritySettingsPathTemplate.match(cXSecuritySettingsName).project; + } + + /** + * Parse the location from CXSecuritySettings resource. + * + * @param {string} cXSecuritySettingsName + * A fully-qualified path representing CXSecuritySettings resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCXSecuritySettingsName(cXSecuritySettingsName: string) { + return this.pathTemplates.cXSecuritySettingsPathTemplate.match(cXSecuritySettingsName).location; + } + + /** + * Parse the security_settings from CXSecuritySettings resource. + * + * @param {string} cXSecuritySettingsName + * A fully-qualified path representing CXSecuritySettings resource. + * @returns {string} A string representing the security_settings. + */ + matchSecuritySettingsFromCXSecuritySettingsName(cXSecuritySettingsName: string) { + return this.pathTemplates.cXSecuritySettingsPathTemplate.match(cXSecuritySettingsName).security_settings; + } + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath(project:string,location:string,conversationDataset:string) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; + } + + /** + * 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 projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project:string,conversationModel:string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; + } + + /** + * 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 projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; + } + + /** + * 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 { + if (this.conversationProfilesStub && !this._terminated) { + return this.conversationProfilesStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_profiles_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_profiles_client_config.json new file mode 100644 index 00000000000..655ad79beb0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_profiles_client_config.json @@ -0,0 +1,64 @@ +{ + "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" + }, + "SetSuggestionFeatureConfig": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ClearSuggestionFeatureConfig": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_profiles_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_profiles_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_profiles_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../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_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/conversations_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversations_client.ts new file mode 100644 index 00000000000..5b3967a2a35 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversations_client.ts @@ -0,0 +1,3175 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ConversationsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + 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}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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}' + ), + projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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 = this._gaxModule.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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2/conversations.create_conversation.js + * region_tag:dialogflow_v2_generated_Conversations_CreateConversation_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createConversation(request, options, callback); + } +/** + * 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 include:samples/generated/v2/conversations.get_conversation.js + * region_tag:dialogflow_v2_generated_Conversations_GetConversation_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getConversation(request, options, callback); + } +/** + * 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 include:samples/generated/v2/conversations.complete_conversation.js + * region_tag:dialogflow_v2_generated_Conversations_CompleteConversation_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.completeConversation(request, options, callback); + } + + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listConversations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversations.createStream( + this.innerApiCalls.listConversations as 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 include:samples/generated/v2/conversations.list_conversations.js + * region_tag:dialogflow_v2_generated_Conversations_ListConversations_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listConversations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversations.asyncIterate( + this.innerApiCalls['listConversations'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listMessages']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMessages.createStream( + this.innerApiCalls.listMessages as 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 include:samples/generated/v2/conversations.list_messages.js + * region_tag:dialogflow_v2_generated_Conversations_ListMessages_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listMessages']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMessages.asyncIterate( + this.innerApiCalls['listMessages'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath(project:string,location:string,conversationDataset:string) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; + } + + /** + * 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 projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project:string,conversationModel:string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; + } + + /** + * 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 projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; + } + + /** + * 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 { + if (this.conversationsStub && !this._terminated) { + return this.conversationsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversations_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversations_client_config.json new file mode 100644 index 00000000000..2718600c519 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/src/v2/conversations_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversations_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversations_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../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_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/documents_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/documents_client.ts new file mode 100644 index 00000000000..e3d41658de3 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/documents_client.ts @@ -0,0 +1,3693 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +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'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new DocumentsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + 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}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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}' + ), + projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2/{name=projects/*/operations/*}:cancel',additional_bindings: [{post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',}], + },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=projects/*/operations/*}',additional_bindings: [{get: '/v2/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2/{name=projects/*}/operations',additional_bindings: [{get: '/v2/{name=projects/*/locations/*}/operations',}], + }]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).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 importDocumentsResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.ImportDocumentsResponse') as gax.protobuf.Type; + const importDocumentsMetadata = 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; + const exportDocumentResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.Document') as gax.protobuf.Type; + const exportDocumentMetadata = 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)), + 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)), + exportDocument: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + exportDocumentResponse.decode.bind(exportDocumentResponse), + exportDocumentMetadata.decode.bind(exportDocumentMetadata)) + }; + + // 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 = this._gaxModule.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', 'importDocuments', 'deleteDocument', 'updateDocument', 'reloadDocument', 'exportDocument']; + 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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2/documents.get_document.js + * region_tag:dialogflow_v2_generated_Documents_GetDocument_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getDocument(request, options, callback); + } + +/** + * Creates a new document. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.KnowledgeOperationMetadata|KnowledgeOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2.Document|Document} + * + * @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 include:samples/generated/v2/documents.create_document.js + * region_tag:dialogflow_v2_generated_Documents_CreateDocument_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2/documents.create_document.js + * region_tag:dialogflow_v2_generated_Documents_CreateDocument_async + */ + async checkCreateDocumentProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createDocument, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates 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. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.KnowledgeOperationMetadata|KnowledgeOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2.ImportDocumentsResponse|ImportDocumentsResponse} + * + * @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.v2.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.v2.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 include:samples/generated/v2/documents.import_documents.js + * region_tag:dialogflow_v2_generated_Documents_ImportDocuments_async + */ + importDocuments( + request?: protos.google.cloud.dialogflow.v2.IImportDocumentsRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + importDocuments( + request: protos.google.cloud.dialogflow.v2.IImportDocumentsRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + importDocuments( + request: protos.google.cloud.dialogflow.v2.IImportDocumentsRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + importDocuments( + request?: protos.google.cloud.dialogflow.v2.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' + ] = this._gaxModule.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 include:samples/generated/v2/documents.import_documents.js + * region_tag:dialogflow_v2_generated_Documents_ImportDocuments_async + */ + async checkImportDocumentsProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importDocuments, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes the specified document. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.KnowledgeOperationMetadata|KnowledgeOperationMetadata} + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * @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 include:samples/generated/v2/documents.delete_document.js + * region_tag:dialogflow_v2_generated_Documents_DeleteDocument_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2/documents.delete_document.js + * region_tag:dialogflow_v2_generated_Documents_DeleteDocument_async + */ + async checkDeleteDocumentProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteDocument, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the specified document. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.KnowledgeOperationMetadata|KnowledgeOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2.Document|Document} + * + * @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 include:samples/generated/v2/documents.update_document.js + * region_tag:dialogflow_v2_generated_Documents_UpdateDocument_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2/documents.update_document.js + * region_tag:dialogflow_v2_generated_Documents_UpdateDocument_async + */ + async checkUpdateDocumentProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateDocument, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * 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. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.KnowledgeOperationMetadata|KnowledgeOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2.Document|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 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 {boolean} [request.importGcsCustomMetadata] + * Optional. Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + * @param {boolean} [request.smartMessagingPartialUpdate] + * Optional. When enabled, the reload request is to apply partial update to the smart + * messaging allowlist. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2/documents.reload_document.js + * region_tag:dialogflow_v2_generated_Documents_ReloadDocument_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2/documents.reload_document.js + * region_tag:dialogflow_v2_generated_Documents_ReloadDocument_async + */ + async checkReloadDocumentProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.reloadDocument, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Exports a smart messaging candidate document into the specified + * destination. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.KnowledgeOperationMetadata|KnowledgeOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2.Document|Document} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the document to export. + * Format: `projects//locations//knowledgeBases//documents/`. + * @param {google.cloud.dialogflow.v2.GcsDestination} request.gcsDestination + * Cloud Storage file path to export the document. + * @param {boolean} request.exportFullContent + * When enabled, export the full content of the document including empirical + * probability. + * @param {boolean} request.smartMessagingPartialUpdate + * When enabled, export the smart messaging allowlist document for partial + * 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 + * 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 include:samples/generated/v2/documents.export_document.js + * region_tag:dialogflow_v2_generated_Documents_ExportDocument_async + */ + exportDocument( + request?: protos.google.cloud.dialogflow.v2.IExportDocumentRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + exportDocument( + request: protos.google.cloud.dialogflow.v2.IExportDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + exportDocument( + request: protos.google.cloud.dialogflow.v2.IExportDocumentRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + exportDocument( + request?: protos.google.cloud.dialogflow.v2.IExportDocumentRequest, + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.exportDocument(request, options, callback); + } +/** + * Check the status of the long running operation returned by `exportDocument()`. + * @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 include:samples/generated/v2/documents.export_document.js + * region_tag:dialogflow_v2_generated_Documents_ExportDocument_async + */ + async checkExportDocumentProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportDocument, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * 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 {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.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, + 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; + 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' + ] = this._gaxModule.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.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listDocuments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDocuments.createStream( + this.innerApiCalls.listDocuments as 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.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 include:samples/generated/v2/documents.list_documents.js + * region_tag:dialogflow_v2_generated_Documents_ListDocuments_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listDocuments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDocuments.asyncIterate( + this.innerApiCalls['listDocuments'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath(project:string,location:string,conversationDataset:string) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; + } + + /** + * 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 projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project:string,conversationModel:string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; + } + + /** + * 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 projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; + } + + /** + * 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 { + if (this.documentsStub && !this._terminated) { + return this.documentsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/documents_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/documents_client_config.json new file mode 100644 index 00000000000..e9c31efb148 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/documents_client_config.json @@ -0,0 +1,69 @@ +{ + "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" + }, + "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" + }, + "ExportDocument": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/documents_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/documents_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/documents_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../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_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/entity_types_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/entity_types_client.ts new file mode 100644 index 00000000000..c27a86f9fc0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/entity_types_client.ts @@ -0,0 +1,3809 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +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'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new EntityTypesClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + 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}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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}' + ), + projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2/{name=projects/*/operations/*}:cancel',additional_bindings: [{post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',}], + },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=projects/*/operations/*}',additional_bindings: [{get: '/v2/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2/{name=projects/*}/operations',additional_bindings: [{get: '/v2/{name=projects/*/locations/*}/operations',}], + }]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).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 = this._gaxModule.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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2/entity_types.get_entity_type.js + * region_tag:dialogflow_v2_generated_EntityTypes_GetEntityType_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getEntityType(request, options, callback); + } +/** + * 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 include:samples/generated/v2/entity_types.create_entity_type.js + * region_tag:dialogflow_v2_generated_EntityTypes_CreateEntityType_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createEntityType(request, options, callback); + } +/** + * 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 include:samples/generated/v2/entity_types.update_entity_type.js + * region_tag:dialogflow_v2_generated_EntityTypes_UpdateEntityType_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'entity_type.name': request.entityType!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateEntityType(request, options, callback); + } +/** + * 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 include:samples/generated/v2/entity_types.delete_entity_type.js + * region_tag:dialogflow_v2_generated_EntityTypes_DeleteEntityType_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteEntityType(request, options, callback); + } + +/** + * Updates/Creates multiple entity types in the specified agent. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: {@link google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse|BatchUpdateEntityTypesResponse} + * + * 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 include:samples/generated/v2/entity_types.batch_update_entity_types.js + * region_tag:dialogflow_v2_generated_EntityTypes_BatchUpdateEntityTypes_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2/entity_types.batch_update_entity_types.js + * region_tag:dialogflow_v2_generated_EntityTypes_BatchUpdateEntityTypes_async + */ + async checkBatchUpdateEntityTypesProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchUpdateEntityTypes, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes entity types in the specified agent. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * 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 include:samples/generated/v2/entity_types.batch_delete_entity_types.js + * region_tag:dialogflow_v2_generated_EntityTypes_BatchDeleteEntityTypes_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2/entity_types.batch_delete_entity_types.js + * region_tag:dialogflow_v2_generated_EntityTypes_BatchDeleteEntityTypes_async + */ + async checkBatchDeleteEntityTypesProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchDeleteEntityTypes, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates multiple new entities in the specified entity type. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * 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 include:samples/generated/v2/entity_types.batch_create_entities.js + * region_tag:dialogflow_v2_generated_EntityTypes_BatchCreateEntities_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2/entity_types.batch_create_entities.js + * region_tag:dialogflow_v2_generated_EntityTypes_BatchCreateEntities_async + */ + async checkBatchCreateEntitiesProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchCreateEntities, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * 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. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * 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 include:samples/generated/v2/entity_types.batch_update_entities.js + * region_tag:dialogflow_v2_generated_EntityTypes_BatchUpdateEntities_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2/entity_types.batch_update_entities.js + * region_tag:dialogflow_v2_generated_EntityTypes_BatchUpdateEntities_async + */ + async checkBatchUpdateEntitiesProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchUpdateEntities, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes entities in the specified entity type. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * 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 include:samples/generated/v2/entity_types.batch_delete_entities.js + * region_tag:dialogflow_v2_generated_EntityTypes_BatchDeleteEntities_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2/entity_types.batch_delete_entities.js + * region_tag:dialogflow_v2_generated_EntityTypes_BatchDeleteEntities_async + */ + async checkBatchDeleteEntitiesProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchDeleteEntities, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listEntityTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEntityTypes.createStream( + this.innerApiCalls.listEntityTypes as 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 include:samples/generated/v2/entity_types.list_entity_types.js + * region_tag:dialogflow_v2_generated_EntityTypes_ListEntityTypes_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listEntityTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEntityTypes.asyncIterate( + this.innerApiCalls['listEntityTypes'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath(project:string,location:string,conversationDataset:string) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; + } + + /** + * 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 projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project:string,conversationModel:string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; + } + + /** + * 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 projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; + } + + /** + * 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 { + if (this.entityTypesStub && !this._terminated) { + return this.entityTypesStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/entity_types_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/entity_types_client_config.json new file mode 100644 index 00000000000..55fa402652a --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/src/v2/entity_types_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/entity_types_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/entity_types_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../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_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/environments_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/environments_client.ts new file mode 100644 index 00000000000..6f834177966 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/environments_client.ts @@ -0,0 +1,3189 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new EnvironmentsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + 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}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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}' + ), + projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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 = this._gaxModule.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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2/environments.get_environment.js + * region_tag:dialogflow_v2_generated_Environments_GetEnvironment_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getEnvironment(request, options, callback); + } +/** + * 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 include:samples/generated/v2/environments.create_environment.js + * region_tag:dialogflow_v2_generated_Environments_CreateEnvironment_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createEnvironment(request, options, callback); + } +/** + * 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 include:samples/generated/v2/environments.update_environment.js + * region_tag:dialogflow_v2_generated_Environments_UpdateEnvironment_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'environment.name': request.environment!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateEnvironment(request, options, callback); + } +/** + * 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 include:samples/generated/v2/environments.delete_environment.js + * region_tag:dialogflow_v2_generated_Environments_DeleteEnvironment_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteEnvironment(request, options, callback); + } + + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listEnvironments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEnvironments.createStream( + this.innerApiCalls.listEnvironments as 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 include:samples/generated/v2/environments.list_environments.js + * region_tag:dialogflow_v2_generated_Environments_ListEnvironments_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listEnvironments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEnvironments.asyncIterate( + this.innerApiCalls['listEnvironments'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['getEnvironmentHistory']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.getEnvironmentHistory.createStream( + this.innerApiCalls.getEnvironmentHistory as 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 include:samples/generated/v2/environments.get_environment_history.js + * region_tag:dialogflow_v2_generated_Environments_GetEnvironmentHistory_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['getEnvironmentHistory']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.getEnvironmentHistory.asyncIterate( + this.innerApiCalls['getEnvironmentHistory'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath(project:string,location:string,conversationDataset:string) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; + } + + /** + * 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 projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project:string,conversationModel:string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; + } + + /** + * 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 projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; + } + + /** + * 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 { + if (this.environmentsStub && !this._terminated) { + return this.environmentsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/environments_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/environments_client_config.json new file mode 100644 index 00000000000..30cdbacb873 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/src/v2/environments_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/environments_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/environments_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../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_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/fulfillments_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/fulfillments_client.ts new file mode 100644 index 00000000000..10d96b38908 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/fulfillments_client.ts @@ -0,0 +1,2589 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} 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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new FulfillmentsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + 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}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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}' + ), + projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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 = this._gaxModule.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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2/fulfillments.get_fulfillment.js + * region_tag:dialogflow_v2_generated_Fulfillments_GetFulfillment_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getFulfillment(request, options, callback); + } +/** + * 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 include:samples/generated/v2/fulfillments.update_fulfillment.js + * region_tag:dialogflow_v2_generated_Fulfillments_UpdateFulfillment_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'fulfillment.name': request.fulfillment!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateFulfillment(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath(project:string,location:string,conversationDataset:string) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; + } + + /** + * 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 projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project:string,conversationModel:string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; + } + + /** + * 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 projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; + } + + /** + * 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 { + if (this.fulfillmentsStub && !this._terminated) { + return this.fulfillmentsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/fulfillments_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/fulfillments_client_config.json new file mode 100644 index 00000000000..615e86feb97 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/src/v2/fulfillments_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/fulfillments_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/fulfillments_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../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_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/gapic_metadata.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/gapic_metadata.json new file mode 100644 index 00000000000..7065b59334f --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/gapic_metadata.json @@ -0,0 +1,1329 @@ +{ + "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" + ] + } + } + } + } + }, + "ConversationDatasets": { + "clients": { + "grpc": { + "libraryClient": "ConversationDatasetsClient", + "rpcs": { + "GetConversationDataset": { + "methods": [ + "getConversationDataset" + ] + }, + "CreateConversationDataset": { + "methods": [ + "createConversationDataset" + ] + }, + "DeleteConversationDataset": { + "methods": [ + "deleteConversationDataset" + ] + }, + "ImportConversationData": { + "methods": [ + "importConversationData" + ] + }, + "ListConversationDatasets": { + "methods": [ + "listConversationDatasets", + "listConversationDatasetsStream", + "listConversationDatasetsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ConversationDatasetsClient", + "rpcs": { + "GetConversationDataset": { + "methods": [ + "getConversationDataset" + ] + }, + "CreateConversationDataset": { + "methods": [ + "createConversationDataset" + ] + }, + "DeleteConversationDataset": { + "methods": [ + "deleteConversationDataset" + ] + }, + "ImportConversationData": { + "methods": [ + "importConversationData" + ] + }, + "ListConversationDatasets": { + "methods": [ + "listConversationDatasets", + "listConversationDatasetsStream", + "listConversationDatasetsAsync" + ] + } + } + } + } + }, + "ConversationModels": { + "clients": { + "grpc": { + "libraryClient": "ConversationModelsClient", + "rpcs": { + "GetConversationModel": { + "methods": [ + "getConversationModel" + ] + }, + "GetConversationModelEvaluation": { + "methods": [ + "getConversationModelEvaluation" + ] + }, + "CreateConversationModel": { + "methods": [ + "createConversationModel" + ] + }, + "DeleteConversationModel": { + "methods": [ + "deleteConversationModel" + ] + }, + "DeployConversationModel": { + "methods": [ + "deployConversationModel" + ] + }, + "UndeployConversationModel": { + "methods": [ + "undeployConversationModel" + ] + }, + "CreateConversationModelEvaluation": { + "methods": [ + "createConversationModelEvaluation" + ] + }, + "ListConversationModels": { + "methods": [ + "listConversationModels", + "listConversationModelsStream", + "listConversationModelsAsync" + ] + }, + "ListConversationModelEvaluations": { + "methods": [ + "listConversationModelEvaluations", + "listConversationModelEvaluationsStream", + "listConversationModelEvaluationsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ConversationModelsClient", + "rpcs": { + "GetConversationModel": { + "methods": [ + "getConversationModel" + ] + }, + "GetConversationModelEvaluation": { + "methods": [ + "getConversationModelEvaluation" + ] + }, + "CreateConversationModel": { + "methods": [ + "createConversationModel" + ] + }, + "DeleteConversationModel": { + "methods": [ + "deleteConversationModel" + ] + }, + "DeployConversationModel": { + "methods": [ + "deployConversationModel" + ] + }, + "UndeployConversationModel": { + "methods": [ + "undeployConversationModel" + ] + }, + "CreateConversationModelEvaluation": { + "methods": [ + "createConversationModelEvaluation" + ] + }, + "ListConversationModels": { + "methods": [ + "listConversationModels", + "listConversationModelsStream", + "listConversationModelsAsync" + ] + }, + "ListConversationModelEvaluations": { + "methods": [ + "listConversationModelEvaluations", + "listConversationModelEvaluationsStream", + "listConversationModelEvaluationsAsync" + ] + } + } + } + } + }, + "ConversationProfiles": { + "clients": { + "grpc": { + "libraryClient": "ConversationProfilesClient", + "rpcs": { + "GetConversationProfile": { + "methods": [ + "getConversationProfile" + ] + }, + "CreateConversationProfile": { + "methods": [ + "createConversationProfile" + ] + }, + "UpdateConversationProfile": { + "methods": [ + "updateConversationProfile" + ] + }, + "DeleteConversationProfile": { + "methods": [ + "deleteConversationProfile" + ] + }, + "SetSuggestionFeatureConfig": { + "methods": [ + "setSuggestionFeatureConfig" + ] + }, + "ClearSuggestionFeatureConfig": { + "methods": [ + "clearSuggestionFeatureConfig" + ] + }, + "ListConversationProfiles": { + "methods": [ + "listConversationProfiles", + "listConversationProfilesStream", + "listConversationProfilesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ConversationProfilesClient", + "rpcs": { + "GetConversationProfile": { + "methods": [ + "getConversationProfile" + ] + }, + "CreateConversationProfile": { + "methods": [ + "createConversationProfile" + ] + }, + "UpdateConversationProfile": { + "methods": [ + "updateConversationProfile" + ] + }, + "DeleteConversationProfile": { + "methods": [ + "deleteConversationProfile" + ] + }, + "SetSuggestionFeatureConfig": { + "methods": [ + "setSuggestionFeatureConfig" + ] + }, + "ClearSuggestionFeatureConfig": { + "methods": [ + "clearSuggestionFeatureConfig" + ] + }, + "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" + ] + }, + "ImportDocuments": { + "methods": [ + "importDocuments" + ] + }, + "DeleteDocument": { + "methods": [ + "deleteDocument" + ] + }, + "UpdateDocument": { + "methods": [ + "updateDocument" + ] + }, + "ReloadDocument": { + "methods": [ + "reloadDocument" + ] + }, + "ExportDocument": { + "methods": [ + "exportDocument" + ] + }, + "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" + ] + }, + "ExportDocument": { + "methods": [ + "exportDocument" + ] + }, + "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" + ] + }, + "StreamingAnalyzeContent": { + "methods": [ + "streamingAnalyzeContent" + ] + }, + "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" + ] + }, + "SuggestSmartReplies": { + "methods": [ + "suggestSmartReplies" + ] + }, + "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/google-cloud-dialogflow/v2/src/v2/index.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/index.ts new file mode 100644 index 00000000000..2decccc0a50 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/index.ts @@ -0,0 +1,35 @@ +// Copyright 2022 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 {ConversationDatasetsClient} from './conversation_datasets_client'; +export {ConversationModelsClient} from './conversation_models_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/google-cloud-dialogflow/v2/src/v2/intents_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/intents_client.ts new file mode 100644 index 00000000000..df50bf6348b --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/intents_client.ts @@ -0,0 +1,3477 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +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'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new IntentsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + 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}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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}' + ), + projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2/{name=projects/*/operations/*}:cancel',additional_bindings: [{post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',}], + },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=projects/*/operations/*}',additional_bindings: [{get: '/v2/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2/{name=projects/*}/operations',additional_bindings: [{get: '/v2/{name=projects/*/locations/*}/operations',}], + }]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).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 = this._gaxModule.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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2/intents.get_intent.js + * region_tag:dialogflow_v2_generated_Intents_GetIntent_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getIntent(request, options, callback); + } +/** + * 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 include:samples/generated/v2/intents.create_intent.js + * region_tag:dialogflow_v2_generated_Intents_CreateIntent_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createIntent(request, options, callback); + } +/** + * 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 include:samples/generated/v2/intents.update_intent.js + * region_tag:dialogflow_v2_generated_Intents_UpdateIntent_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'intent.name': request.intent!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateIntent(request, options, callback); + } +/** + * 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 include:samples/generated/v2/intents.delete_intent.js + * region_tag:dialogflow_v2_generated_Intents_DeleteIntent_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteIntent(request, options, callback); + } + +/** + * Updates/Creates multiple intents in the specified agent. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: {@link google.cloud.dialogflow.v2.BatchUpdateIntentsResponse|BatchUpdateIntentsResponse} + * + * 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 include:samples/generated/v2/intents.batch_update_intents.js + * region_tag:dialogflow_v2_generated_Intents_BatchUpdateIntents_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2/intents.batch_update_intents.js + * region_tag:dialogflow_v2_generated_Intents_BatchUpdateIntents_async + */ + async checkBatchUpdateIntentsProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchUpdateIntents, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes intents in the specified agent. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * 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 include:samples/generated/v2/intents.batch_delete_intents.js + * region_tag:dialogflow_v2_generated_Intents_BatchDeleteIntents_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2/intents.batch_delete_intents.js + * region_tag:dialogflow_v2_generated_Intents_BatchDeleteIntents_async + */ + async checkBatchDeleteIntentsProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchDeleteIntents, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listIntents']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listIntents.createStream( + this.innerApiCalls.listIntents as 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 include:samples/generated/v2/intents.list_intents.js + * region_tag:dialogflow_v2_generated_Intents_ListIntents_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listIntents']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listIntents.asyncIterate( + this.innerApiCalls['listIntents'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath(project:string,location:string,conversationDataset:string) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; + } + + /** + * 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 projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project:string,conversationModel:string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; + } + + /** + * 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 projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; + } + + /** + * 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 { + if (this.intentsStub && !this._terminated) { + return this.intentsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/intents_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/intents_client_config.json new file mode 100644 index 00000000000..ad20f4c607d --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/src/v2/intents_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/intents_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/intents_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../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_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/knowledge_bases_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/knowledge_bases_client.ts new file mode 100644 index 00000000000..daf20fca10a --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/knowledge_bases_client.ts @@ -0,0 +1,3036 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new KnowledgeBasesClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + 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}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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}' + ), + projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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 = this._gaxModule.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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2/knowledge_bases.get_knowledge_base.js + * region_tag:dialogflow_v2_generated_KnowledgeBases_GetKnowledgeBase_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getKnowledgeBase(request, options, callback); + } +/** + * 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 include:samples/generated/v2/knowledge_bases.create_knowledge_base.js + * region_tag:dialogflow_v2_generated_KnowledgeBases_CreateKnowledgeBase_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createKnowledgeBase(request, options, callback); + } +/** + * 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 include:samples/generated/v2/knowledge_bases.delete_knowledge_base.js + * region_tag:dialogflow_v2_generated_KnowledgeBases_DeleteKnowledgeBase_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteKnowledgeBase(request, options, callback); + } +/** + * 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 include:samples/generated/v2/knowledge_bases.update_knowledge_base.js + * region_tag:dialogflow_v2_generated_KnowledgeBases_UpdateKnowledgeBase_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'knowledge_base.name': request.knowledgeBase!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateKnowledgeBase(request, options, callback); + } + + /** + * 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 {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.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, + 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; + 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' + ] = this._gaxModule.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.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listKnowledgeBases']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listKnowledgeBases.createStream( + this.innerApiCalls.listKnowledgeBases as 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.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 include:samples/generated/v2/knowledge_bases.list_knowledge_bases.js + * region_tag:dialogflow_v2_generated_KnowledgeBases_ListKnowledgeBases_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listKnowledgeBases']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listKnowledgeBases.asyncIterate( + this.innerApiCalls['listKnowledgeBases'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath(project:string,location:string,conversationDataset:string) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; + } + + /** + * 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 projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project:string,conversationModel:string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; + } + + /** + * 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 projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; + } + + /** + * 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 { + if (this.knowledgeBasesStub && !this._terminated) { + return this.knowledgeBasesStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/knowledge_bases_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/knowledge_bases_client_config.json new file mode 100644 index 00000000000..580ef4d8686 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/src/v2/knowledge_bases_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/knowledge_bases_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/knowledge_bases_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../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_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/participants_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/participants_client.ts new file mode 100644 index 00000000000..635963d00b8 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/participants_client.ts @@ -0,0 +1,3294 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform, PassThrough} from 'stream'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ParticipantsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + 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}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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}' + ), + projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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') + }; + + // Some of the methods on this service provide streaming responses. + // Provide descriptors for these. + this.descriptors.stream = { + streamingAnalyzeContent: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, opts.fallback === 'rest') + }; + + // 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 = this._gaxModule.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', 'streamingAnalyzeContent', 'suggestArticles', 'suggestFaqAnswers', 'suggestSmartReplies']; + for (const methodName of participantsStubMethods) { + const callPromise = this.participantsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + if (methodName in this.descriptors.stream) { + const stream = new PassThrough(); + setImmediate(() => { + stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); + }); + return stream; + } + 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.stream[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2/participants.create_participant.js + * region_tag:dialogflow_v2_generated_Participants_CreateParticipant_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createParticipant(request, options, callback); + } +/** + * 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 include:samples/generated/v2/participants.get_participant.js + * region_tag:dialogflow_v2_generated_Participants_GetParticipant_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getParticipant(request, options, callback); + } +/** + * 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 include:samples/generated/v2/participants.update_participant.js + * region_tag:dialogflow_v2_generated_Participants_UpdateParticipant_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'participant.name': request.participant!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateParticipant(request, options, callback); + } +/** + * 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 {google.cloud.dialogflow.v2.AssistQueryParameters} request.assistQueryParams + * Parameters for a human assist query. + * @param {google.protobuf.Struct} request.cxParameters + * Additional parameters to be put into Dialogflow CX session parameters. To + * remove a parameter from the session, clients should explicitly set the + * parameter value to null. + * + * Note: this field should only be used if you are connecting to a Dialogflow + * CX agent. + * @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 include:samples/generated/v2/participants.analyze_content.js + * region_tag:dialogflow_v2_generated_Participants_AnalyzeContent_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'participant': request.participant ?? '', + }); + this.initialize(); + return this.innerApiCalls.analyzeContent(request, options, callback); + } +/** + * 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] + * 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.v2.SuggestArticlesRequest.latest_message|latest_message} to use as context + * when compiling the suggestion. By default 20 and at most 50. + * @param {google.cloud.dialogflow.v2.AssistQueryParameters} request.assistQueryParams + * Parameters for a human assist query. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2/participants.suggest_articles.js + * region_tag:dialogflow_v2_generated_Participants_SuggestArticles_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.suggestArticles(request, options, callback); + } +/** + * 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 {google.cloud.dialogflow.v2.AssistQueryParameters} request.assistQueryParams + * Parameters for a human assist query. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2/participants.suggest_faq_answers.js + * region_tag:dialogflow_v2_generated_Participants_SuggestFaqAnswers_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.suggestFaqAnswers(request, options, callback); + } +/** + * 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.v2.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 + * 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.v2.SuggestSmartRepliesResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2/participants.suggest_smart_replies.js + * region_tag:dialogflow_v2_generated_Participants_SuggestSmartReplies_async + */ + suggestSmartReplies( + request?: protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse, + protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest|undefined, {}|undefined + ]>; + suggestSmartReplies( + request: protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse, + protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest|null|undefined, + {}|null|undefined>): void; + suggestSmartReplies( + request: protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse, + protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest|null|undefined, + {}|null|undefined>): void; + suggestSmartReplies( + request?: protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse, + protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse, + protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse, + protos.google.cloud.dialogflow.v2.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.suggestSmartReplies(request, options, callback); + } + +/** + * Adds a text (chat, for example), or audio (phone recording, for example) + * message from a participant into the conversation. + * Note: This method is only available through the gRPC API (not REST). + * + * The top-level message sent to the client by the server is + * `StreamingAnalyzeContentResponse`. Multiple response messages can be + * returned in order. The first one or more messages contain the + * `recognition_result` field. Each result represents a more complete + * transcript of what the user said. The next message contains the + * `reply_text` field and potentially the `reply_audio` field. The message can + * also contain the `automated_agent_reply` field. + * + * 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} [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 [StreamingAnalyzeContentRequest]{@link google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest} for write() method, and + * will emit objects representing [StreamingAnalyzeContentResponse]{@link google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse} 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 include:samples/generated/v2/participants.streaming_analyze_content.js + * region_tag:dialogflow_v2_generated_Participants_StreamingAnalyzeContent_async + */ + streamingAnalyzeContent( + options?: CallOptions): + gax.CancellableStream { + this.initialize(); + return this.innerApiCalls.streamingAnalyzeContent(null, options); + } + + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listParticipants']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listParticipants.createStream( + this.innerApiCalls.listParticipants as 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 include:samples/generated/v2/participants.list_participants.js + * region_tag:dialogflow_v2_generated_Participants_ListParticipants_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listParticipants']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listParticipants.asyncIterate( + this.innerApiCalls['listParticipants'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath(project:string,location:string,conversationDataset:string) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; + } + + /** + * 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 projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project:string,conversationModel:string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; + } + + /** + * 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 projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; + } + + /** + * 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 { + if (this.participantsStub && !this._terminated) { + return this.participantsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/participants_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/participants_client_config.json new file mode 100644 index 00000000000..e81ecec6eea --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/participants_client_config.json @@ -0,0 +1,74 @@ +{ + "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" + }, + "StreamingAnalyzeContent": { + "timeout_millis": 220000, + "retry_codes_name": "non_idempotent", + "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" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/participants_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/participants_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/participants_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../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_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/session_entity_types_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/session_entity_types_client.ts new file mode 100644 index 00000000000..caf93d317c2 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/session_entity_types_client.ts @@ -0,0 +1,3036 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SessionEntityTypesClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + 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}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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}' + ), + projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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 = this._gaxModule.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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2/session_entity_types.get_session_entity_type.js + * region_tag:dialogflow_v2_generated_SessionEntityTypes_GetSessionEntityType_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getSessionEntityType(request, options, callback); + } +/** + * 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 include:samples/generated/v2/session_entity_types.create_session_entity_type.js + * region_tag:dialogflow_v2_generated_SessionEntityTypes_CreateSessionEntityType_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createSessionEntityType(request, options, callback); + } +/** + * 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 include:samples/generated/v2/session_entity_types.update_session_entity_type.js + * region_tag:dialogflow_v2_generated_SessionEntityTypes_UpdateSessionEntityType_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'session_entity_type.name': request.sessionEntityType!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateSessionEntityType(request, options, callback); + } +/** + * 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 include:samples/generated/v2/session_entity_types.delete_session_entity_type.js + * region_tag:dialogflow_v2_generated_SessionEntityTypes_DeleteSessionEntityType_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteSessionEntityType(request, options, callback); + } + + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listSessionEntityTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSessionEntityTypes.createStream( + this.innerApiCalls.listSessionEntityTypes as 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 include:samples/generated/v2/session_entity_types.list_session_entity_types.js + * region_tag:dialogflow_v2_generated_SessionEntityTypes_ListSessionEntityTypes_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listSessionEntityTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSessionEntityTypes.asyncIterate( + this.innerApiCalls['listSessionEntityTypes'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath(project:string,location:string,conversationDataset:string) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; + } + + /** + * 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 projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project:string,conversationModel:string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; + } + + /** + * 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 projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; + } + + /** + * 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 { + if (this.sessionEntityTypesStub && !this._terminated) { + return this.sessionEntityTypesStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/session_entity_types_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/session_entity_types_client_config.json new file mode 100644 index 00000000000..52a412a1243 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/src/v2/session_entity_types_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/session_entity_types_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/session_entity_types_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../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_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/sessions_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/sessions_client.ts new file mode 100644 index 00000000000..fcbc5cbb62e --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/sessions_client.ts @@ -0,0 +1,2856 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} from 'google-gax'; +import {PassThrough} from 'stream'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SessionsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + 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}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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}' + ), + projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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(this._gaxModule.StreamType.BIDI_STREAMING, opts.fallback === 'rest') + }; + + // 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 = this._gaxModule.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) { + if (methodName in this.descriptors.stream) { + const stream = new PassThrough(); + setImmediate(() => { + stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); + }); + return stream; + } + 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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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. + * + * If you might use + * [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) + * or other CCAI products now or in the future, consider using + * {@link google.cloud.dialogflow.v2.Participants.AnalyzeContent|AnalyzeContent} + * instead of `DetectIntent`. `AnalyzeContent` has additional + * functionality for Agent Assist and other CCAI products. + * + * 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 include:samples/generated/v2/sessions.detect_intent.js + * region_tag:dialogflow_v2_generated_Sessions_DetectIntent_async + */ + 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; + 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' + ] = this._gaxModule.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). + * + * If you might use + * [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) + * or other CCAI products now or in the future, consider using + * {@link google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent|StreamingAnalyzeContent} + * instead of `StreamingDetectIntent`. `StreamingAnalyzeContent` has + * additional functionality for Agent Assist and other CCAI products. + * + * 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 include:samples/generated/v2/sessions.streaming_detect_intent.js + * region_tag:dialogflow_v2_generated_Sessions_StreamingDetectIntent_async + */ + streamingDetectIntent( + options?: CallOptions): + gax.CancellableStream { + this.initialize(); + return this.innerApiCalls.streamingDetectIntent(null, options); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath(project:string,location:string,conversationDataset:string) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; + } + + /** + * 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 projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project:string,conversationModel:string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; + } + + /** + * 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 projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; + } + + /** + * 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 { + if (this.sessionsStub && !this._terminated) { + return this.sessionsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/sessions_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/sessions_client_config.json new file mode 100644 index 00000000000..b9c1b92dab2 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/src/v2/sessions_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/sessions_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/sessions_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../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_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/versions_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/versions_client.ts new file mode 100644 index 00000000000..ec0b2e44719 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/versions_client.ts @@ -0,0 +1,2979 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new VersionsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + 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}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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}' + ), + projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + 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 = this._gaxModule.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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2/versions.get_version.js + * region_tag:dialogflow_v2_generated_Versions_GetVersion_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getVersion(request, options, callback); + } +/** + * 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 include:samples/generated/v2/versions.create_version.js + * region_tag:dialogflow_v2_generated_Versions_CreateVersion_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createVersion(request, options, callback); + } +/** + * 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 include:samples/generated/v2/versions.update_version.js + * region_tag:dialogflow_v2_generated_Versions_UpdateVersion_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'version.name': request.version!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateVersion(request, options, callback); + } +/** + * 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 include:samples/generated/v2/versions.delete_version.js + * region_tag:dialogflow_v2_generated_Versions_DeleteVersion_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteVersion(request, options, callback); + } + + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listVersions.createStream( + this.innerApiCalls.listVersions as 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 include:samples/generated/v2/versions.list_versions.js + * region_tag:dialogflow_v2_generated_Versions_ListVersions_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listVersions.asyncIterate( + this.innerApiCalls['listVersions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath(project:string,location:string,conversationDataset:string) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; + } + + /** + * 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 projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project:string,conversationModel:string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { + return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; + } + + /** + * 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 projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + }); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; + } + + /** + * 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 { + if (this.versionsStub && !this._terminated) { + return this.versionsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/versions_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/versions_client_config.json new file mode 100644 index 00000000000..db17e434d96 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/src/v2/versions_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/versions_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/versions_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../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_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-dialogflow/v2/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..e198f451416 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/system-test/fixtures/sample/src/index.js @@ -0,0 +1,43 @@ +// Copyright 2022 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 conversationDatasetsClient = new dialogflow.ConversationDatasetsClient(); + const conversationModelsClient = new dialogflow.ConversationModelsClient(); + 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/google-cloud-dialogflow/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-dialogflow/v2/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..c7cb97490ef --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,128 @@ +// Copyright 2022 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, ConversationDatasetsClient, ConversationModelsClient, 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 doStuffWithConversationDatasetsClient(client: ConversationDatasetsClient) { + client.close(); +} +function doStuffWithConversationModelsClient(client: ConversationModelsClient) { + 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 conversationDatasetsClient = new ConversationDatasetsClient(); + doStuffWithConversationDatasetsClient(conversationDatasetsClient); + // check that the client instance can be created + const conversationModelsClient = new ConversationModelsClient(); + doStuffWithConversationModelsClient(conversationModelsClient); + // 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/google-cloud-dialogflow/v2/system-test/install.ts b/owl-bot-staging/google-cloud-dialogflow/v2/system-test/install.ts new file mode 100644 index 00000000000..557a57558e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2022 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/google-cloud-dialogflow/v2/test/gapic_agents_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_agents_v2.ts new file mode 100644 index 00000000000..4fbb1d84759 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_agents_v2.ts @@ -0,0 +1,3766 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.agentsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.agentsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAgent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAgent(request), expectedError); + const actualRequest = (client.innerApiCalls.getAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAgent with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAgent(request), expectedError); + }); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SetAgentRequest', ['agent', 'parent']); + request.agent.parent = defaultValue1; + const expectedHeaderRequestParams = `agent.parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.setAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SetAgentRequest', ['agent', 'parent']); + request.agent.parent = defaultValue1; + const expectedHeaderRequestParams = `agent.parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.setAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SetAgentRequest', ['agent', 'parent']); + request.agent.parent = defaultValue1; + const expectedHeaderRequestParams = `agent.parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setAgent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setAgent(request), expectedError); + const actualRequest = (client.innerApiCalls.setAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setAgent with closed client', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SetAgentRequest', ['agent', 'parent']); + request.agent.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setAgent(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteAgent = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAgent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.deleteAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAgent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteAgent(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAgent with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteAgent(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetValidationResultRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getValidationResult as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getValidationResult as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetValidationResultRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getValidationResult as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getValidationResult as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetValidationResultRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getValidationResult = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getValidationResult(request), expectedError); + const actualRequest = (client.innerApiCalls.getValidationResult as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getValidationResult as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getValidationResult with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetValidationResultRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getValidationResult(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.TrainAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.trainAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.trainAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.TrainAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.trainAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.trainAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.TrainAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.trainAgent = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.trainAgent(request), expectedError); + const actualRequest = (client.innerApiCalls.trainAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.trainAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.TrainAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.trainAgent = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.trainAgent(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.trainAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.trainAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ExportAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.exportAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ExportAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.exportAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ExportAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportAgent = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.exportAgent(request), expectedError); + const actualRequest = (client.innerApiCalls.exportAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ExportAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportAgent = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.exportAgent(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.exportAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ImportAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.importAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ImportAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.importAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ImportAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importAgent = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.importAgent(request), expectedError); + const actualRequest = (client.innerApiCalls.importAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ImportAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importAgent = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.importAgent(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.importAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.RestoreAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.RestoreAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.RestoreAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreAgent = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.restoreAgent(request), expectedError); + const actualRequest = (client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.RestoreAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreAgent = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.restoreAgent(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SearchAgentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.searchAgents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchAgents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SearchAgentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.searchAgents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchAgents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SearchAgentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.searchAgents = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.searchAgents(request), expectedError); + const actualRequest = (client.innerApiCalls.searchAgents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchAgents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SearchAgentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.searchAgents.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SearchAgentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.searchAgents.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SearchAgentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.searchAgents.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SearchAgentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.searchAgents.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('conversationDataset', () => { + const fakePath = "/rendered/path/conversationDataset"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_dataset: "conversationDatasetValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, "conversationDatasetValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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('projectConversationModel', () => { + const fakePath = "/rendered/path/projectConversationModel"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = client.matchConversationModelFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { + const fakePath = "/rendered/path/projectLocationConversationModel"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_answer_records_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_answer_records_v2.ts new file mode 100644 index 00000000000..f0d1d2454cc --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_answer_records_v2.ts @@ -0,0 +1,2555 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.answerRecordsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.answerRecordsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest', ['answerRecord', 'name']); + request.answerRecord.name = defaultValue1; + const expectedHeaderRequestParams = `answer_record.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateAnswerRecord as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAnswerRecord as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest', ['answerRecord', 'name']); + request.answerRecord.name = defaultValue1; + const expectedHeaderRequestParams = `answer_record.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateAnswerRecord as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAnswerRecord as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest', ['answerRecord', 'name']); + request.answerRecord.name = defaultValue1; + const expectedHeaderRequestParams = `answer_record.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAnswerRecord = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateAnswerRecord(request), expectedError); + const actualRequest = (client.innerApiCalls.updateAnswerRecord as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAnswerRecord as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAnswerRecord with closed client', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest', ['answerRecord', 'name']); + request.answerRecord.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateAnswerRecord(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListAnswerRecordsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listAnswerRecords as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAnswerRecords as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListAnswerRecordsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listAnswerRecords as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAnswerRecords as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListAnswerRecordsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAnswerRecords = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAnswerRecords(request), expectedError); + const actualRequest = (client.innerApiCalls.listAnswerRecords as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAnswerRecords as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListAnswerRecordsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listAnswerRecords.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListAnswerRecordsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listAnswerRecords.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListAnswerRecordsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListAnswerRecordsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('conversationDataset', () => { + const fakePath = "/rendered/path/conversationDataset"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_dataset: "conversationDatasetValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, "conversationDatasetValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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('projectConversationModel', () => { + const fakePath = "/rendered/path/projectConversationModel"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = client.matchConversationModelFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { + const fakePath = "/rendered/path/projectLocationConversationModel"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_contexts_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_contexts_v2.ts new file mode 100644 index 00000000000..d5137f233d0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_contexts_v2.ts @@ -0,0 +1,3025 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.contextsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.contextsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetContextRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getContext as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getContext as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetContextRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getContext as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getContext as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetContextRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getContext = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getContext(request), expectedError); + const actualRequest = (client.innerApiCalls.getContext as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getContext as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getContext with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetContextRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getContext(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateContextRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createContext as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createContext as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateContextRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createContext as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createContext as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateContextRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createContext = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createContext(request), expectedError); + const actualRequest = (client.innerApiCalls.createContext as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createContext as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createContext with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateContextRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createContext(request), expectedError); + }); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateContextRequest', ['context', 'name']); + request.context.name = defaultValue1; + const expectedHeaderRequestParams = `context.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateContext as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateContext as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateContextRequest', ['context', 'name']); + request.context.name = defaultValue1; + const expectedHeaderRequestParams = `context.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateContext as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateContext as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateContextRequest', ['context', 'name']); + request.context.name = defaultValue1; + const expectedHeaderRequestParams = `context.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateContext = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateContext(request), expectedError); + const actualRequest = (client.innerApiCalls.updateContext as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateContext as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateContext with closed client', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateContextRequest', ['context', 'name']); + request.context.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateContext(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteContextRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteContext = stubSimpleCall(expectedResponse); + const [response] = await client.deleteContext(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteContext as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteContext as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteContextRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.deleteContext as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteContext as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteContextRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteContext = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteContext(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteContext as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteContext as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteContext with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteContextRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteContext(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteAllContextsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteAllContexts = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAllContexts(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAllContexts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAllContexts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteAllContextsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.deleteAllContexts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAllContexts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteAllContextsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAllContexts = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteAllContexts(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteAllContexts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAllContexts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAllContexts with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteAllContextsRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteAllContexts(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListContextsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listContexts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listContexts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListContextsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listContexts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listContexts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListContextsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listContexts = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listContexts(request), expectedError); + const actualRequest = (client.innerApiCalls.listContexts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listContexts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListContextsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listContexts.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListContextsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listContexts.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListContextsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listContexts.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListContextsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listContexts.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('conversationDataset', () => { + const fakePath = "/rendered/path/conversationDataset"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_dataset: "conversationDatasetValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, "conversationDatasetValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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('projectConversationModel', () => { + const fakePath = "/rendered/path/projectConversationModel"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = client.matchConversationModelFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { + const fakePath = "/rendered/path/projectLocationConversationModel"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_conversation_datasets_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_conversation_datasets_v2.ts new file mode 100644 index 00000000000..621794d6411 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_conversation_datasets_v2.ts @@ -0,0 +1,3322 @@ +// Copyright 2022 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 conversationdatasetsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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.ConversationDatasetsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = conversationdatasetsModule.v2.ConversationDatasetsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = conversationdatasetsModule.v2.ConversationDatasetsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = conversationdatasetsModule.v2.ConversationDatasetsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.conversationDatasetsStub, undefined); + await client.initialize(); + assert(client.conversationDatasetsStub); + }); + + it('has close method for the initialized client', done => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.conversationDatasetsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.conversationDatasetsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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('getConversationDataset', () => { + it('invokes getConversationDataset without error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationDatasetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationDataset() + ); + client.innerApiCalls.getConversationDataset = stubSimpleCall(expectedResponse); + const [response] = await client.getConversationDataset(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getConversationDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConversationDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationDataset without error using callback', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationDatasetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationDataset() + ); + client.innerApiCalls.getConversationDataset = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConversationDataset( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversationDataset|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getConversationDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConversationDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationDataset with error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationDatasetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConversationDataset = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getConversationDataset(request), expectedError); + const actualRequest = (client.innerApiCalls.getConversationDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConversationDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationDataset with closed client', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationDatasetRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getConversationDataset(request), expectedError); + }); + }); + + describe('createConversationDataset', () => { + it('invokes createConversationDataset without error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationDatasetRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConversationDataset = stubLongRunningCall(expectedResponse); + const [operation] = await client.createConversationDataset(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createConversationDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConversationDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationDataset without error using callback', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationDatasetRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConversationDataset = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createConversationDataset( + 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); + const actualRequest = (client.innerApiCalls.createConversationDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConversationDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationDataset with call error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationDatasetRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversationDataset = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createConversationDataset(request), expectedError); + const actualRequest = (client.innerApiCalls.createConversationDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConversationDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationDataset with LRO error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationDatasetRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversationDataset = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createConversationDataset(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createConversationDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConversationDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateConversationDatasetProgress without error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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.checkCreateConversationDatasetProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateConversationDatasetProgress with error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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.checkCreateConversationDatasetProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteConversationDataset', () => { + it('invokes deleteConversationDataset without error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteConversationDataset = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteConversationDataset(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteConversationDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConversationDataset without error using callback', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteConversationDataset = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteConversationDataset( + 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); + const actualRequest = (client.innerApiCalls.deleteConversationDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConversationDataset with call error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConversationDataset = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteConversationDataset(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteConversationDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConversationDataset with LRO error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConversationDataset = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteConversationDataset(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteConversationDataset as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationDataset as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteConversationDatasetProgress without error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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.checkDeleteConversationDatasetProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteConversationDatasetProgress with error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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.checkDeleteConversationDatasetProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('importConversationData', () => { + it('invokes importConversationData without error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ImportConversationDataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ImportConversationDataRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importConversationData = stubLongRunningCall(expectedResponse); + const [operation] = await client.importConversationData(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.importConversationData as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importConversationData as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importConversationData without error using callback', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ImportConversationDataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ImportConversationDataRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importConversationData = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importConversationData( + 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); + const actualRequest = (client.innerApiCalls.importConversationData as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importConversationData as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importConversationData with call error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ImportConversationDataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ImportConversationDataRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importConversationData = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.importConversationData(request), expectedError); + const actualRequest = (client.innerApiCalls.importConversationData as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importConversationData as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importConversationData with LRO error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ImportConversationDataRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ImportConversationDataRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importConversationData = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.importConversationData(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.importConversationData as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importConversationData as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkImportConversationDataProgress without error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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.checkImportConversationDataProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportConversationDataProgress with error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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.checkImportConversationDataProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listConversationDatasets', () => { + it('invokes listConversationDatasets without error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationDatasetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationDatasetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationDataset()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationDataset()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationDataset()), + ]; + client.innerApiCalls.listConversationDatasets = stubSimpleCall(expectedResponse); + const [response] = await client.listConversationDatasets(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listConversationDatasets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConversationDatasets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationDatasets without error using callback', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationDatasetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationDatasetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationDataset()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationDataset()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationDataset()), + ]; + client.innerApiCalls.listConversationDatasets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listConversationDatasets( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversationDataset[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listConversationDatasets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConversationDatasets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationDatasets with error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationDatasetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationDatasetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listConversationDatasets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listConversationDatasets(request), expectedError); + const actualRequest = (client.innerApiCalls.listConversationDatasets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConversationDatasets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationDatasetsStream without error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationDatasetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationDatasetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationDataset()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationDataset()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationDataset()), + ]; + client.descriptors.page.listConversationDatasets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listConversationDatasetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.ConversationDataset[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.ConversationDataset) => { + 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.listConversationDatasets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConversationDatasets, request)); + assert( + (client.descriptors.page.listConversationDatasets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listConversationDatasetsStream with error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationDatasetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationDatasetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConversationDatasets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listConversationDatasetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.ConversationDataset[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.ConversationDataset) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listConversationDatasets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConversationDatasets, request)); + assert( + (client.descriptors.page.listConversationDatasets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConversationDatasets without error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationDatasetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationDatasetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationDataset()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationDataset()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationDataset()), + ]; + client.descriptors.page.listConversationDatasets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IConversationDataset[] = []; + const iterable = client.listConversationDatasetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listConversationDatasets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listConversationDatasets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConversationDatasets with error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationDatasetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationDatasetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConversationDatasets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listConversationDatasetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IConversationDataset[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listConversationDatasets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listConversationDatasets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('conversationDataset', () => { + const fakePath = "/rendered/path/conversationDataset"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_dataset: "conversationDatasetValue", + }; + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, "conversationDatasetValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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('projectConversationModel', () => { + const fakePath = "/rendered/path/projectConversationModel"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + }; + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = client.matchConversationModelFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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('projectLocationConversationModel', () => { + const fakePath = "/rendered/path/projectLocationConversationModel"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + }; + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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/google-cloud-dialogflow/v2/test/gapic_conversation_models_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_conversation_models_v2.ts new file mode 100644 index 00000000000..4f1bb56b70f --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_conversation_models_v2.ts @@ -0,0 +1,3945 @@ +// Copyright 2022 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 conversationmodelsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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.ConversationModelsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = conversationmodelsModule.v2.ConversationModelsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = conversationmodelsModule.v2.ConversationModelsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = conversationmodelsModule.v2.ConversationModelsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.conversationModelsStub, undefined); + await client.initialize(); + assert(client.conversationModelsStub); + }); + + it('has close method for the initialized client', done => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.conversationModelsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.conversationModelsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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('getConversationModel', () => { + it('invokes getConversationModel without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationModelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModel() + ); + client.innerApiCalls.getConversationModel = stubSimpleCall(expectedResponse); + const [response] = await client.getConversationModel(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getConversationModel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConversationModel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationModel without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationModelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModel() + ); + client.innerApiCalls.getConversationModel = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConversationModel( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversationModel|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getConversationModel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConversationModel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationModel with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationModelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConversationModel = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getConversationModel(request), expectedError); + const actualRequest = (client.innerApiCalls.getConversationModel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConversationModel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationModel with closed client', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationModelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationModelRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getConversationModel(request), expectedError); + }); + }); + + describe('getConversationModelEvaluation', () => { + it('invokes getConversationModelEvaluation without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation() + ); + client.innerApiCalls.getConversationModelEvaluation = stubSimpleCall(expectedResponse); + const [response] = await client.getConversationModelEvaluation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getConversationModelEvaluation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConversationModelEvaluation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationModelEvaluation without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation() + ); + client.innerApiCalls.getConversationModelEvaluation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConversationModelEvaluation( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversationModelEvaluation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getConversationModelEvaluation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConversationModelEvaluation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationModelEvaluation with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConversationModelEvaluation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getConversationModelEvaluation(request), expectedError); + const actualRequest = (client.innerApiCalls.getConversationModelEvaluation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConversationModelEvaluation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationModelEvaluation with closed client', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getConversationModelEvaluation(request), expectedError); + }); + }); + + describe('createConversationModel', () => { + it('invokes createConversationModel without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationModelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationModelRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConversationModel = stubLongRunningCall(expectedResponse); + const [operation] = await client.createConversationModel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createConversationModel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConversationModel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationModel without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationModelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationModelRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConversationModel = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createConversationModel( + 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); + const actualRequest = (client.innerApiCalls.createConversationModel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConversationModel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationModel with call error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationModelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationModelRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversationModel = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createConversationModel(request), expectedError); + const actualRequest = (client.innerApiCalls.createConversationModel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConversationModel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationModel with LRO error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationModelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationModelRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversationModel = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createConversationModel(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createConversationModel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConversationModel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateConversationModelProgress without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + 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.checkCreateConversationModelProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateConversationModelProgress with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + 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.checkCreateConversationModelProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteConversationModel', () => { + it('invokes deleteConversationModel without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteConversationModelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteConversationModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteConversationModel = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteConversationModel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteConversationModel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationModel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConversationModel without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteConversationModelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteConversationModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteConversationModel = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteConversationModel( + 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); + const actualRequest = (client.innerApiCalls.deleteConversationModel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationModel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConversationModel with call error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteConversationModelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteConversationModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConversationModel = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteConversationModel(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteConversationModel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationModel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConversationModel with LRO error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteConversationModelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteConversationModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConversationModel = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteConversationModel(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteConversationModel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationModel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteConversationModelProgress without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + 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.checkDeleteConversationModelProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteConversationModelProgress with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + 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.checkDeleteConversationModelProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deployConversationModel', () => { + it('invokes deployConversationModel without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeployConversationModelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeployConversationModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deployConversationModel = stubLongRunningCall(expectedResponse); + const [operation] = await client.deployConversationModel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deployConversationModel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deployConversationModel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deployConversationModel without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeployConversationModelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeployConversationModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deployConversationModel = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deployConversationModel( + 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); + const actualRequest = (client.innerApiCalls.deployConversationModel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deployConversationModel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deployConversationModel with call error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeployConversationModelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeployConversationModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deployConversationModel = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deployConversationModel(request), expectedError); + const actualRequest = (client.innerApiCalls.deployConversationModel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deployConversationModel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deployConversationModel with LRO error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeployConversationModelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeployConversationModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deployConversationModel = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deployConversationModel(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deployConversationModel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deployConversationModel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeployConversationModelProgress without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + 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.checkDeployConversationModelProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeployConversationModelProgress with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + 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.checkDeployConversationModelProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('undeployConversationModel', () => { + it('invokes undeployConversationModel without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UndeployConversationModelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UndeployConversationModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.undeployConversationModel = stubLongRunningCall(expectedResponse); + const [operation] = await client.undeployConversationModel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.undeployConversationModel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.undeployConversationModel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes undeployConversationModel without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UndeployConversationModelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UndeployConversationModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.undeployConversationModel = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.undeployConversationModel( + 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); + const actualRequest = (client.innerApiCalls.undeployConversationModel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.undeployConversationModel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes undeployConversationModel with call error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UndeployConversationModelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UndeployConversationModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.undeployConversationModel = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.undeployConversationModel(request), expectedError); + const actualRequest = (client.innerApiCalls.undeployConversationModel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.undeployConversationModel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes undeployConversationModel with LRO error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UndeployConversationModelRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UndeployConversationModelRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.undeployConversationModel = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.undeployConversationModel(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.undeployConversationModel as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.undeployConversationModel as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUndeployConversationModelProgress without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + 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.checkUndeployConversationModelProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUndeployConversationModelProgress with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + 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.checkUndeployConversationModelProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createConversationModelEvaluation', () => { + it('invokes createConversationModelEvaluation without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConversationModelEvaluation = stubLongRunningCall(expectedResponse); + const [operation] = await client.createConversationModelEvaluation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createConversationModelEvaluation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConversationModelEvaluation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationModelEvaluation without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConversationModelEvaluation = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createConversationModelEvaluation( + 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); + const actualRequest = (client.innerApiCalls.createConversationModelEvaluation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConversationModelEvaluation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationModelEvaluation with call error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversationModelEvaluation = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createConversationModelEvaluation(request), expectedError); + const actualRequest = (client.innerApiCalls.createConversationModelEvaluation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConversationModelEvaluation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationModelEvaluation with LRO error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversationModelEvaluation = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createConversationModelEvaluation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createConversationModelEvaluation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConversationModelEvaluation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateConversationModelEvaluationProgress without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + 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.checkCreateConversationModelEvaluationProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateConversationModelEvaluationProgress with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + 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.checkCreateConversationModelEvaluationProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listConversationModels', () => { + it('invokes listConversationModels without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModel()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModel()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModel()), + ]; + client.innerApiCalls.listConversationModels = stubSimpleCall(expectedResponse); + const [response] = await client.listConversationModels(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listConversationModels as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConversationModels as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationModels without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModel()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModel()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModel()), + ]; + client.innerApiCalls.listConversationModels = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listConversationModels( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversationModel[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listConversationModels as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConversationModels as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationModels with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listConversationModels = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listConversationModels(request), expectedError); + const actualRequest = (client.innerApiCalls.listConversationModels as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConversationModels as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationModelsStream without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModel()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModel()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModel()), + ]; + client.descriptors.page.listConversationModels.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listConversationModelsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.ConversationModel[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.ConversationModel) => { + 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.listConversationModels.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConversationModels, request)); + assert( + (client.descriptors.page.listConversationModels.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listConversationModelsStream with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConversationModels.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listConversationModelsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.ConversationModel[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.ConversationModel) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listConversationModels.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConversationModels, request)); + assert( + (client.descriptors.page.listConversationModels.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConversationModels without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModel()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModel()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModel()), + ]; + client.descriptors.page.listConversationModels.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IConversationModel[] = []; + const iterable = client.listConversationModelsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listConversationModels.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listConversationModels.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConversationModels with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConversationModels.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listConversationModelsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IConversationModel[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listConversationModels.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listConversationModels.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listConversationModelEvaluations', () => { + it('invokes listConversationModelEvaluations without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation()), + ]; + client.innerApiCalls.listConversationModelEvaluations = stubSimpleCall(expectedResponse); + const [response] = await client.listConversationModelEvaluations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listConversationModelEvaluations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConversationModelEvaluations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationModelEvaluations without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation()), + ]; + client.innerApiCalls.listConversationModelEvaluations = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listConversationModelEvaluations( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversationModelEvaluation[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listConversationModelEvaluations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConversationModelEvaluations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationModelEvaluations with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listConversationModelEvaluations = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listConversationModelEvaluations(request), expectedError); + const actualRequest = (client.innerApiCalls.listConversationModelEvaluations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConversationModelEvaluations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationModelEvaluationsStream without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation()), + ]; + client.descriptors.page.listConversationModelEvaluations.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listConversationModelEvaluationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.ConversationModelEvaluation[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.ConversationModelEvaluation) => { + 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.listConversationModelEvaluations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConversationModelEvaluations, request)); + assert( + (client.descriptors.page.listConversationModelEvaluations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listConversationModelEvaluationsStream with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConversationModelEvaluations.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listConversationModelEvaluationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.ConversationModelEvaluation[] = []; + stream.on('data', (response: protos.google.cloud.dialogflow.v2.ConversationModelEvaluation) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listConversationModelEvaluations.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConversationModelEvaluations, request)); + assert( + (client.descriptors.page.listConversationModelEvaluations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConversationModelEvaluations without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation()), + ]; + client.descriptors.page.listConversationModelEvaluations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IConversationModelEvaluation[] = []; + const iterable = client.listConversationModelEvaluationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listConversationModelEvaluations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listConversationModelEvaluations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConversationModelEvaluations with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConversationModelEvaluations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listConversationModelEvaluationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IConversationModelEvaluation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listConversationModelEvaluations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listConversationModelEvaluations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('conversationDataset', () => { + const fakePath = "/rendered/path/conversationDataset"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_dataset: "conversationDatasetValue", + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, "conversationDatasetValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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('projectConversationModel', () => { + const fakePath = "/rendered/path/projectConversationModel"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = client.matchConversationModelFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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('projectLocationConversationModel', () => { + const fakePath = "/rendered/path/projectLocationConversationModel"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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/google-cloud-dialogflow/v2/test/gapic_conversation_profiles_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_conversation_profiles_v2.ts new file mode 100644 index 00000000000..207b6fa67d4 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_conversation_profiles_v2.ts @@ -0,0 +1,3504 @@ +// Copyright 2022 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, LROperation, operationsProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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.ConversationProfilesClient', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.conversationProfilesStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.conversationProfilesStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getConversationProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConversationProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getConversationProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConversationProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConversationProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getConversationProfile(request), expectedError); + const actualRequest = (client.innerApiCalls.getConversationProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConversationProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationProfile with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationProfileRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getConversationProfile(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationProfileRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createConversationProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConversationProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationProfileRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createConversationProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConversationProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationProfileRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversationProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createConversationProfile(request), expectedError); + const actualRequest = (client.innerApiCalls.createConversationProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConversationProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationProfile with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationProfileRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createConversationProfile(request), expectedError); + }); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateConversationProfileRequest', ['conversationProfile', 'name']); + request.conversationProfile.name = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateConversationProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConversationProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateConversationProfileRequest', ['conversationProfile', 'name']); + request.conversationProfile.name = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateConversationProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConversationProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateConversationProfileRequest', ['conversationProfile', 'name']); + request.conversationProfile.name = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateConversationProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateConversationProfile(request), expectedError); + const actualRequest = (client.innerApiCalls.updateConversationProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConversationProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConversationProfile with closed client', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateConversationProfileRequest', ['conversationProfile', 'name']); + request.conversationProfile.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateConversationProfile(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteConversationProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteConversationProfile = stubSimpleCall(expectedResponse); + const [response] = await client.deleteConversationProfile(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteConversationProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteConversationProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.deleteConversationProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteConversationProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConversationProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteConversationProfile(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteConversationProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConversationProfile with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteConversationProfileRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteConversationProfile(request), expectedError); + }); + }); + + describe('setSuggestionFeatureConfig', () => { + it('invokes setSuggestionFeatureConfig 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.SetSuggestionFeatureConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest', ['conversationProfile']); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.setSuggestionFeatureConfig = stubLongRunningCall(expectedResponse); + const [operation] = await client.setSuggestionFeatureConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setSuggestionFeatureConfig 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.SetSuggestionFeatureConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest', ['conversationProfile']); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.setSuggestionFeatureConfig = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setSuggestionFeatureConfig( + 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); + const actualRequest = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setSuggestionFeatureConfig with call 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.SetSuggestionFeatureConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest', ['conversationProfile']); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setSuggestionFeatureConfig = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.setSuggestionFeatureConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setSuggestionFeatureConfig with LRO 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.SetSuggestionFeatureConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest', ['conversationProfile']); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setSuggestionFeatureConfig = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.setSuggestionFeatureConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkSetSuggestionFeatureConfigProgress without error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + 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.checkSetSuggestionFeatureConfigProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkSetSuggestionFeatureConfigProgress with error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + 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.checkSetSuggestionFeatureConfigProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('clearSuggestionFeatureConfig', () => { + it('invokes clearSuggestionFeatureConfig 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.ClearSuggestionFeatureConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest', ['conversationProfile']); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.clearSuggestionFeatureConfig = stubLongRunningCall(expectedResponse); + const [operation] = await client.clearSuggestionFeatureConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes clearSuggestionFeatureConfig 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.ClearSuggestionFeatureConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest', ['conversationProfile']); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.clearSuggestionFeatureConfig = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.clearSuggestionFeatureConfig( + 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); + const actualRequest = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes clearSuggestionFeatureConfig with call 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.ClearSuggestionFeatureConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest', ['conversationProfile']); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.clearSuggestionFeatureConfig = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.clearSuggestionFeatureConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes clearSuggestionFeatureConfig with LRO 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.ClearSuggestionFeatureConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest', ['conversationProfile']); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.clearSuggestionFeatureConfig = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.clearSuggestionFeatureConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkClearSuggestionFeatureConfigProgress without error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + 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.checkClearSuggestionFeatureConfigProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkClearSuggestionFeatureConfigProgress with error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + 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.checkClearSuggestionFeatureConfigProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listConversationProfiles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConversationProfiles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listConversationProfiles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConversationProfiles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listConversationProfiles = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listConversationProfiles(request), expectedError); + const actualRequest = (client.innerApiCalls.listConversationProfiles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConversationProfiles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listConversationProfiles.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listConversationProfiles.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listConversationProfiles.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listConversationProfiles.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('cXSecuritySettings', () => { + const fakePath = "/rendered/path/cXSecuritySettings"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + security_settings: "securitySettingsValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.cXSecuritySettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.cXSecuritySettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('cXSecuritySettingsPath', () => { + const result = client.cXSecuritySettingsPath("projectValue", "locationValue", "securitySettingsValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.cXSecuritySettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCXSecuritySettingsName', () => { + const result = client.matchProjectFromCXSecuritySettingsName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.cXSecuritySettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCXSecuritySettingsName', () => { + const result = client.matchLocationFromCXSecuritySettingsName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.cXSecuritySettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSecuritySettingsFromCXSecuritySettingsName', () => { + const result = client.matchSecuritySettingsFromCXSecuritySettingsName(fakePath); + assert.strictEqual(result, "securitySettingsValue"); + assert((client.pathTemplates.cXSecuritySettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('conversationDataset', () => { + const fakePath = "/rendered/path/conversationDataset"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_dataset: "conversationDatasetValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, "conversationDatasetValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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('projectConversationModel', () => { + const fakePath = "/rendered/path/projectConversationModel"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = client.matchConversationModelFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { + const fakePath = "/rendered/path/projectLocationConversationModel"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_conversations_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_conversations_v2.ts new file mode 100644 index 00000000000..df3bd430122 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_conversations_v2.ts @@ -0,0 +1,3012 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.conversationsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.conversationsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createConversation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConversation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createConversation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConversation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createConversation(request), expectedError); + const actualRequest = (client.innerApiCalls.createConversation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConversation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversation with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createConversation(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getConversation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConversation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getConversation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConversation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConversation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getConversation(request), expectedError); + const actualRequest = (client.innerApiCalls.getConversation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConversation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversation with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getConversation(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CompleteConversationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.completeConversation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.completeConversation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CompleteConversationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.completeConversation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.completeConversation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CompleteConversationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.completeConversation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.completeConversation(request), expectedError); + const actualRequest = (client.innerApiCalls.completeConversation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.completeConversation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes completeConversation with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CompleteConversationRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.completeConversation(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listConversations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConversations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listConversations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConversations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listConversations = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listConversations(request), expectedError); + const actualRequest = (client.innerApiCalls.listConversations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConversations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listConversations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listConversations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listConversations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listConversations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listMessages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMessages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listMessages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMessages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMessages = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listMessages(request), expectedError); + const actualRequest = (client.innerApiCalls.listMessages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMessages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listMessages.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listMessages.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listMessages.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listMessages.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('conversationDataset', () => { + const fakePath = "/rendered/path/conversationDataset"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_dataset: "conversationDatasetValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, "conversationDatasetValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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('projectConversationModel', () => { + const fakePath = "/rendered/path/projectConversationModel"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = client.matchConversationModelFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { + const fakePath = "/rendered/path/projectLocationConversationModel"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_documents_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_documents_v2.ts new file mode 100644 index 00000000000..1d90f24ec19 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_documents_v2.ts @@ -0,0 +1,3750 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.documentsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.documentsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDocument = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getDocument(request), expectedError); + const actualRequest = (client.innerApiCalls.getDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDocument with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getDocument(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateDocumentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateDocumentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateDocumentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDocument = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createDocument(request), expectedError); + const actualRequest = (client.innerApiCalls.createDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateDocumentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDocument = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createDocument(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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('importDocuments', () => { + it('invokes importDocuments 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.ImportDocumentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ImportDocumentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.importDocuments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importDocuments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importDocuments 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.ImportDocumentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ImportDocumentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.importDocuments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importDocuments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importDocuments 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.ImportDocumentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ImportDocumentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importDocuments = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.importDocuments(request), expectedError); + const actualRequest = (client.innerApiCalls.importDocuments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importDocuments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importDocuments 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.ImportDocumentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ImportDocumentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importDocuments = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.importDocuments(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.importDocuments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importDocuments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkImportDocumentsProgress 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.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.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.checkImportDocumentsProgress(''), 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.deleteDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.deleteDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDocument = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteDocument(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDocument = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteDocument(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateDocumentRequest', ['document', 'name']); + request.document.name = defaultValue1; + const expectedHeaderRequestParams = `document.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateDocumentRequest', ['document', 'name']); + request.document.name = defaultValue1; + const expectedHeaderRequestParams = `document.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateDocumentRequest', ['document', 'name']); + request.document.name = defaultValue1; + const expectedHeaderRequestParams = `document.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDocument = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateDocument(request), expectedError); + const actualRequest = (client.innerApiCalls.updateDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateDocumentRequest', ['document', 'name']); + request.document.name = defaultValue1; + const expectedHeaderRequestParams = `document.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDocument = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateDocument(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ReloadDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.reloadDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reloadDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ReloadDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.reloadDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reloadDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ReloadDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.reloadDocument = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.reloadDocument(request), expectedError); + const actualRequest = (client.innerApiCalls.reloadDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reloadDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ReloadDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.reloadDocument = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.reloadDocument(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.reloadDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reloadDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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('exportDocument', () => { + it('invokes exportDocument 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.ExportDocumentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ExportDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportDocument = stubLongRunningCall(expectedResponse); + const [operation] = await client.exportDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.exportDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportDocument 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.ExportDocumentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ExportDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportDocument = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.exportDocument( + 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); + const actualRequest = (client.innerApiCalls.exportDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportDocument 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.ExportDocumentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ExportDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportDocument = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.exportDocument(request), expectedError); + const actualRequest = (client.innerApiCalls.exportDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportDocument 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.ExportDocumentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ExportDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportDocument = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.exportDocument(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.exportDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkExportDocumentProgress 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.checkExportDocumentProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkExportDocumentProgress 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.checkExportDocumentProgress(''), 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListDocumentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listDocuments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDocuments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListDocumentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listDocuments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDocuments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListDocumentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDocuments = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listDocuments(request), expectedError); + const actualRequest = (client.innerApiCalls.listDocuments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDocuments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListDocumentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListDocumentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListDocumentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listDocuments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListDocumentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listDocuments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('conversationDataset', () => { + const fakePath = "/rendered/path/conversationDataset"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_dataset: "conversationDatasetValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, "conversationDatasetValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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('projectConversationModel', () => { + const fakePath = "/rendered/path/projectConversationModel"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = client.matchConversationModelFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { + const fakePath = "/rendered/path/projectLocationConversationModel"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_entity_types_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_entity_types_v2.ts new file mode 100644 index 00000000000..7b2fede66a3 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_entity_types_v2.ts @@ -0,0 +1,3920 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.entityTypesStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.entityTypesStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getEntityType(request), expectedError); + const actualRequest = (client.innerApiCalls.getEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEntityType with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getEntityType(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateEntityTypeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateEntityTypeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateEntityTypeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createEntityType(request), expectedError); + const actualRequest = (client.innerApiCalls.createEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEntityType with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateEntityTypeRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createEntityType(request), expectedError); + }); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateEntityTypeRequest', ['entityType', 'name']); + request.entityType.name = defaultValue1; + const expectedHeaderRequestParams = `entity_type.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateEntityTypeRequest', ['entityType', 'name']); + request.entityType.name = defaultValue1; + const expectedHeaderRequestParams = `entity_type.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateEntityTypeRequest', ['entityType', 'name']); + request.entityType.name = defaultValue1; + const expectedHeaderRequestParams = `entity_type.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateEntityType(request), expectedError); + const actualRequest = (client.innerApiCalls.updateEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEntityType with closed client', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateEntityTypeRequest', ['entityType', 'name']); + request.entityType.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateEntityType(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.deleteEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.deleteEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteEntityType(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteEntityType with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteEntityType(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchUpdateEntityTypes(request), expectedError); + const actualRequest = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchUpdateEntityTypes(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchDeleteEntityTypes(request), expectedError); + const actualRequest = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchDeleteEntityTypes(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchCreateEntities as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateEntities as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchCreateEntities as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateEntities as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateEntities = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchCreateEntities(request), expectedError); + const actualRequest = (client.innerApiCalls.batchCreateEntities as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateEntities as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateEntities = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchCreateEntities(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.batchCreateEntities as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateEntities as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchUpdateEntities as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntities as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchUpdateEntities as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntities as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateEntities = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchUpdateEntities(request), expectedError); + const actualRequest = (client.innerApiCalls.batchUpdateEntities as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntities as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateEntities = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchUpdateEntities(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.batchUpdateEntities as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntities as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchDeleteEntities as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntities as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchDeleteEntities as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntities as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteEntities = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchDeleteEntities(request), expectedError); + const actualRequest = (client.innerApiCalls.batchDeleteEntities as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntities as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteEntities = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchDeleteEntities(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.batchDeleteEntities as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntities as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listEntityTypes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listEntityTypes(request), expectedError); + const actualRequest = (client.innerApiCalls.listEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listEntityTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listEntityTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('conversationDataset', () => { + const fakePath = "/rendered/path/conversationDataset"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_dataset: "conversationDatasetValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, "conversationDatasetValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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('projectConversationModel', () => { + const fakePath = "/rendered/path/projectConversationModel"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = client.matchConversationModelFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { + const fakePath = "/rendered/path/projectLocationConversationModel"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_environments_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_environments_v2.ts new file mode 100644 index 00000000000..6708ef9f5b8 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_environments_v2.ts @@ -0,0 +1,3124 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.environmentsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.environmentsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEnvironmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getEnvironment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEnvironment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEnvironmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getEnvironment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEnvironment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEnvironmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getEnvironment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getEnvironment(request), expectedError); + const actualRequest = (client.innerApiCalls.getEnvironment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEnvironment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEnvironment with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEnvironmentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getEnvironment(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateEnvironmentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createEnvironment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createEnvironment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateEnvironmentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createEnvironment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createEnvironment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateEnvironmentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createEnvironment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createEnvironment(request), expectedError); + const actualRequest = (client.innerApiCalls.createEnvironment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createEnvironment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEnvironment with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateEnvironmentRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createEnvironment(request), expectedError); + }); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateEnvironmentRequest', ['environment', 'name']); + request.environment.name = defaultValue1; + const expectedHeaderRequestParams = `environment.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateEnvironment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateEnvironment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateEnvironmentRequest', ['environment', 'name']); + request.environment.name = defaultValue1; + const expectedHeaderRequestParams = `environment.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateEnvironment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateEnvironment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateEnvironmentRequest', ['environment', 'name']); + request.environment.name = defaultValue1; + const expectedHeaderRequestParams = `environment.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateEnvironment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateEnvironment(request), expectedError); + const actualRequest = (client.innerApiCalls.updateEnvironment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateEnvironment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEnvironment with closed client', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateEnvironmentRequest', ['environment', 'name']); + request.environment.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateEnvironment(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteEnvironmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteEnvironment = stubSimpleCall(expectedResponse); + const [response] = await client.deleteEnvironment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteEnvironment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteEnvironment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteEnvironmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.deleteEnvironment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteEnvironment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteEnvironmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteEnvironment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteEnvironment(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteEnvironment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteEnvironment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteEnvironment with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteEnvironmentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteEnvironment(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEnvironmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listEnvironments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listEnvironments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEnvironmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listEnvironments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listEnvironments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEnvironmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listEnvironments = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listEnvironments(request), expectedError); + const actualRequest = (client.innerApiCalls.listEnvironments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listEnvironments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEnvironmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listEnvironments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEnvironmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listEnvironments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEnvironmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEnvironmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.getEnvironmentHistory as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEnvironmentHistory as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.getEnvironmentHistory as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEnvironmentHistory as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getEnvironmentHistory = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getEnvironmentHistory(request), expectedError); + const actualRequest = (client.innerApiCalls.getEnvironmentHistory as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEnvironmentHistory as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.getEnvironmentHistory.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.getEnvironmentHistory.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.getEnvironmentHistory.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.getEnvironmentHistory.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('conversationDataset', () => { + const fakePath = "/rendered/path/conversationDataset"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_dataset: "conversationDatasetValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, "conversationDatasetValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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('projectConversationModel', () => { + const fakePath = "/rendered/path/projectConversationModel"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = client.matchConversationModelFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { + const fakePath = "/rendered/path/projectLocationConversationModel"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_fulfillments_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_fulfillments_v2.ts new file mode 100644 index 00000000000..a1f8f9221b4 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_fulfillments_v2.ts @@ -0,0 +1,2361 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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 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.FulfillmentsClient', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.fulfillmentsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.fulfillmentsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetFulfillmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getFulfillment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFulfillment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetFulfillmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getFulfillment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFulfillment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetFulfillmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFulfillment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFulfillment(request), expectedError); + const actualRequest = (client.innerApiCalls.getFulfillment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFulfillment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFulfillment with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetFulfillmentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFulfillment(request), expectedError); + }); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateFulfillmentRequest', ['fulfillment', 'name']); + request.fulfillment.name = defaultValue1; + const expectedHeaderRequestParams = `fulfillment.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateFulfillment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFulfillment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateFulfillmentRequest', ['fulfillment', 'name']); + request.fulfillment.name = defaultValue1; + const expectedHeaderRequestParams = `fulfillment.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateFulfillment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFulfillment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateFulfillmentRequest', ['fulfillment', 'name']); + request.fulfillment.name = defaultValue1; + const expectedHeaderRequestParams = `fulfillment.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFulfillment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateFulfillment(request), expectedError); + const actualRequest = (client.innerApiCalls.updateFulfillment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFulfillment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFulfillment with closed client', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateFulfillmentRequest', ['fulfillment', 'name']); + request.fulfillment.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateFulfillment(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('conversationDataset', () => { + const fakePath = "/rendered/path/conversationDataset"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_dataset: "conversationDatasetValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, "conversationDatasetValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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('projectConversationModel', () => { + const fakePath = "/rendered/path/projectConversationModel"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = client.matchConversationModelFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { + const fakePath = "/rendered/path/projectLocationConversationModel"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_intents_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_intents_v2.ts new file mode 100644 index 00000000000..4d062a1b1fc --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_intents_v2.ts @@ -0,0 +1,3458 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.intentsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.intentsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetIntentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetIntentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetIntentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getIntent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIntent(request), expectedError); + const actualRequest = (client.innerApiCalls.getIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIntent with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetIntentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getIntent(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateIntentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateIntentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateIntentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createIntent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createIntent(request), expectedError); + const actualRequest = (client.innerApiCalls.createIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createIntent with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateIntentRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createIntent(request), expectedError); + }); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateIntentRequest', ['intent', 'name']); + request.intent.name = defaultValue1; + const expectedHeaderRequestParams = `intent.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateIntentRequest', ['intent', 'name']); + request.intent.name = defaultValue1; + const expectedHeaderRequestParams = `intent.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateIntentRequest', ['intent', 'name']); + request.intent.name = defaultValue1; + const expectedHeaderRequestParams = `intent.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateIntent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateIntent(request), expectedError); + const actualRequest = (client.innerApiCalls.updateIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateIntent with closed client', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateIntentRequest', ['intent', 'name']); + request.intent.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateIntent(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteIntentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteIntent = stubSimpleCall(expectedResponse); + const [response] = await client.deleteIntent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteIntentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.deleteIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteIntentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteIntent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteIntent(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteIntent with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteIntentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteIntent(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchUpdateIntents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateIntents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchUpdateIntents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateIntents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateIntents = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchUpdateIntents(request), expectedError); + const actualRequest = (client.innerApiCalls.batchUpdateIntents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateIntents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateIntents = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchUpdateIntents(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.batchUpdateIntents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateIntents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchDeleteIntents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteIntents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchDeleteIntents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteIntents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteIntents = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchDeleteIntents(request), expectedError); + const actualRequest = (client.innerApiCalls.batchDeleteIntents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteIntents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteIntents = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchDeleteIntents(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.batchDeleteIntents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteIntents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listIntents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listIntents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listIntents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listIntents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listIntents = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listIntents(request), expectedError); + const actualRequest = (client.innerApiCalls.listIntents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listIntents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listIntents.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listIntents.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listIntents.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listIntents.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('conversationDataset', () => { + const fakePath = "/rendered/path/conversationDataset"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_dataset: "conversationDatasetValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, "conversationDatasetValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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('projectConversationModel', () => { + const fakePath = "/rendered/path/projectConversationModel"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = client.matchConversationModelFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { + const fakePath = "/rendered/path/projectLocationConversationModel"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_knowledge_bases_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_knowledge_bases_v2.ts new file mode 100644 index 00000000000..2cc801d5cd2 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_knowledge_bases_v2.ts @@ -0,0 +1,2879 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.knowledgeBasesStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.knowledgeBasesStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getKnowledgeBase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getKnowledgeBase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getKnowledgeBase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getKnowledgeBase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getKnowledgeBase = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getKnowledgeBase(request), expectedError); + const actualRequest = (client.innerApiCalls.getKnowledgeBase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getKnowledgeBase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getKnowledgeBase with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getKnowledgeBase(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createKnowledgeBase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createKnowledgeBase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createKnowledgeBase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createKnowledgeBase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createKnowledgeBase = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createKnowledgeBase(request), expectedError); + const actualRequest = (client.innerApiCalls.createKnowledgeBase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createKnowledgeBase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createKnowledgeBase with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createKnowledgeBase(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteKnowledgeBase = stubSimpleCall(expectedResponse); + const [response] = await client.deleteKnowledgeBase(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteKnowledgeBase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteKnowledgeBase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.deleteKnowledgeBase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteKnowledgeBase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteKnowledgeBase = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteKnowledgeBase(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteKnowledgeBase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteKnowledgeBase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteKnowledgeBase with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteKnowledgeBase(request), expectedError); + }); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest', ['knowledgeBase', 'name']); + request.knowledgeBase.name = defaultValue1; + const expectedHeaderRequestParams = `knowledge_base.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateKnowledgeBase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateKnowledgeBase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest', ['knowledgeBase', 'name']); + request.knowledgeBase.name = defaultValue1; + const expectedHeaderRequestParams = `knowledge_base.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateKnowledgeBase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateKnowledgeBase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest', ['knowledgeBase', 'name']); + request.knowledgeBase.name = defaultValue1; + const expectedHeaderRequestParams = `knowledge_base.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateKnowledgeBase = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateKnowledgeBase(request), expectedError); + const actualRequest = (client.innerApiCalls.updateKnowledgeBase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateKnowledgeBase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateKnowledgeBase with closed client', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest', ['knowledgeBase', 'name']); + request.knowledgeBase.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateKnowledgeBase(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listKnowledgeBases as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listKnowledgeBases as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listKnowledgeBases as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listKnowledgeBases as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listKnowledgeBases = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listKnowledgeBases(request), expectedError); + const actualRequest = (client.innerApiCalls.listKnowledgeBases as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listKnowledgeBases as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listKnowledgeBases.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listKnowledgeBases.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('conversationDataset', () => { + const fakePath = "/rendered/path/conversationDataset"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_dataset: "conversationDatasetValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, "conversationDatasetValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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('projectConversationModel', () => { + const fakePath = "/rendered/path/projectConversationModel"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = client.matchConversationModelFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { + const fakePath = "/rendered/path/projectLocationConversationModel"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_participants_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_participants_v2.ts new file mode 100644 index 00000000000..c5272f6f17b --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_participants_v2.ts @@ -0,0 +1,3276 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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); +} + +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', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.participantsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.participantsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateParticipantRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createParticipant as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createParticipant as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateParticipantRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createParticipant as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createParticipant as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateParticipantRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createParticipant = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createParticipant(request), expectedError); + const actualRequest = (client.innerApiCalls.createParticipant as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createParticipant as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createParticipant with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateParticipantRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createParticipant(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetParticipantRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getParticipant as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getParticipant as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetParticipantRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getParticipant as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getParticipant as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetParticipantRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getParticipant = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getParticipant(request), expectedError); + const actualRequest = (client.innerApiCalls.getParticipant as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getParticipant as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getParticipant with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetParticipantRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getParticipant(request), expectedError); + }); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateParticipantRequest', ['participant', 'name']); + request.participant.name = defaultValue1; + const expectedHeaderRequestParams = `participant.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateParticipant as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateParticipant as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateParticipantRequest', ['participant', 'name']); + request.participant.name = defaultValue1; + const expectedHeaderRequestParams = `participant.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateParticipant as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateParticipant as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateParticipantRequest', ['participant', 'name']); + request.participant.name = defaultValue1; + const expectedHeaderRequestParams = `participant.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateParticipant = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateParticipant(request), expectedError); + const actualRequest = (client.innerApiCalls.updateParticipant as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateParticipant as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateParticipant with closed client', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateParticipantRequest', ['participant', 'name']); + request.participant.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateParticipant(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.AnalyzeContentRequest', ['participant']); + request.participant = defaultValue1; + const expectedHeaderRequestParams = `participant=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.analyzeContent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.analyzeContent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.AnalyzeContentRequest', ['participant']); + request.participant = defaultValue1; + const expectedHeaderRequestParams = `participant=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.analyzeContent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.analyzeContent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.AnalyzeContentRequest', ['participant']); + request.participant = defaultValue1; + const expectedHeaderRequestParams = `participant=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.analyzeContent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.analyzeContent(request), expectedError); + const actualRequest = (client.innerApiCalls.analyzeContent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.analyzeContent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes analyzeContent with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.AnalyzeContentRequest', ['participant']); + request.participant = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.analyzeContent(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SuggestArticlesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.suggestArticles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.suggestArticles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SuggestArticlesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.suggestArticles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.suggestArticles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SuggestArticlesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.suggestArticles = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.suggestArticles(request), expectedError); + const actualRequest = (client.innerApiCalls.suggestArticles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.suggestArticles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestArticles with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SuggestArticlesRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.suggestArticles(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.suggestFaqAnswers as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.suggestFaqAnswers as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.suggestFaqAnswers as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.suggestFaqAnswers as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.suggestFaqAnswers = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.suggestFaqAnswers(request), expectedError); + const actualRequest = (client.innerApiCalls.suggestFaqAnswers as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.suggestFaqAnswers as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestFaqAnswers with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.suggestFaqAnswers(request), expectedError); + }); + }); + + describe('suggestSmartReplies', () => { + it('invokes suggestSmartReplies 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.SuggestSmartRepliesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SuggestSmartRepliesResponse() + ); + client.innerApiCalls.suggestSmartReplies = stubSimpleCall(expectedResponse); + const [response] = await client.suggestSmartReplies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.suggestSmartReplies as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.suggestSmartReplies as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestSmartReplies 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.SuggestSmartRepliesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SuggestSmartRepliesResponse() + ); + client.innerApiCalls.suggestSmartReplies = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.suggestSmartReplies( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.suggestSmartReplies as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.suggestSmartReplies as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestSmartReplies 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.SuggestSmartRepliesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.suggestSmartReplies = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.suggestSmartReplies(request), expectedError); + const actualRequest = (client.innerApiCalls.suggestSmartReplies as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.suggestSmartReplies as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestSmartReplies with closed client', 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.SuggestSmartRepliesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.suggestSmartReplies(request), expectedError); + }); + }); + + describe('streamingAnalyzeContent', () => { + it('invokes streamingAnalyzeContent 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.StreamingAnalyzeContentRequest() + ); + + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse() + ); + client.innerApiCalls.streamingAnalyzeContent = stubBidiStreamingCall(expectedResponse); + const stream = client.streamingAnalyzeContent(); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse) => { + 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.streamingAnalyzeContent as SinonStub) + .getCall(0).calledWith(null)); + assert.deepStrictEqual(((stream as unknown as PassThrough) + ._transform as SinonStub).getCall(0).args[0], request); + }); + + it('invokes streamingAnalyzeContent 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.StreamingAnalyzeContentRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.streamingAnalyzeContent = stubBidiStreamingCall(undefined, expectedError); + const stream = client.streamingAnalyzeContent(); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse) => { + resolve(response); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + await assert.rejects(promise, expectedError); + assert((client.innerApiCalls.streamingAnalyzeContent as SinonStub) + .getCall(0).calledWith(null)); + assert.deepStrictEqual(((stream as unknown as PassThrough) + ._transform as SinonStub).getCall(0).args[0], request); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListParticipantsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listParticipants as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listParticipants as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListParticipantsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listParticipants as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listParticipants as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListParticipantsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listParticipants = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listParticipants(request), expectedError); + const actualRequest = (client.innerApiCalls.listParticipants as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listParticipants as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListParticipantsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listParticipants.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListParticipantsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listParticipants.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListParticipantsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listParticipants.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListParticipantsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listParticipants.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('conversationDataset', () => { + const fakePath = "/rendered/path/conversationDataset"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_dataset: "conversationDatasetValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, "conversationDatasetValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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('projectConversationModel', () => { + const fakePath = "/rendered/path/projectConversationModel"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = client.matchConversationModelFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { + const fakePath = "/rendered/path/projectLocationConversationModel"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_session_entity_types_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_session_entity_types_v2.ts new file mode 100644 index 00000000000..ca30f3938fc --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_session_entity_types_v2.ts @@ -0,0 +1,2917 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.sessionEntityTypesStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.sessionEntityTypesStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getSessionEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSessionEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getSessionEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSessionEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSessionEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSessionEntityType(request), expectedError); + const actualRequest = (client.innerApiCalls.getSessionEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSessionEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSessionEntityType with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSessionEntityType(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createSessionEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSessionEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createSessionEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSessionEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSessionEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createSessionEntityType(request), expectedError); + const actualRequest = (client.innerApiCalls.createSessionEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSessionEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSessionEntityType with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createSessionEntityType(request), expectedError); + }); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest', ['sessionEntityType', 'name']); + request.sessionEntityType.name = defaultValue1; + const expectedHeaderRequestParams = `session_entity_type.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateSessionEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSessionEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest', ['sessionEntityType', 'name']); + request.sessionEntityType.name = defaultValue1; + const expectedHeaderRequestParams = `session_entity_type.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateSessionEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSessionEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest', ['sessionEntityType', 'name']); + request.sessionEntityType.name = defaultValue1; + const expectedHeaderRequestParams = `session_entity_type.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSessionEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSessionEntityType(request), expectedError); + const actualRequest = (client.innerApiCalls.updateSessionEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSessionEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSessionEntityType with closed client', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest', ['sessionEntityType', 'name']); + request.sessionEntityType.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSessionEntityType(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteSessionEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.deleteSessionEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteSessionEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSessionEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.deleteSessionEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSessionEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSessionEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteSessionEntityType(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteSessionEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSessionEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSessionEntityType with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteSessionEntityType(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listSessionEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSessionEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listSessionEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSessionEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSessionEntityTypes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSessionEntityTypes(request), expectedError); + const actualRequest = (client.innerApiCalls.listSessionEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSessionEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listSessionEntityTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listSessionEntityTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listSessionEntityTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listSessionEntityTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('conversationDataset', () => { + const fakePath = "/rendered/path/conversationDataset"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_dataset: "conversationDatasetValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, "conversationDatasetValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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('projectConversationModel', () => { + const fakePath = "/rendered/path/projectConversationModel"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = client.matchConversationModelFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { + const fakePath = "/rendered/path/projectLocationConversationModel"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_sessions_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_sessions_v2.ts new file mode 100644 index 00000000000..b1148126e37 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_sessions_v2.ts @@ -0,0 +1,2524 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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); +} + +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.SessionsClient', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.sessionsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.sessionsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DetectIntentRequest', ['session']); + request.session = defaultValue1; + const expectedHeaderRequestParams = `session=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.detectIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.detectIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DetectIntentRequest', ['session']); + request.session = defaultValue1; + const expectedHeaderRequestParams = `session=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.detectIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.detectIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DetectIntentRequest', ['session']); + request.session = defaultValue1; + const expectedHeaderRequestParams = `session=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.detectIntent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.detectIntent(request), expectedError); + const actualRequest = (client.innerApiCalls.detectIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.detectIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes detectIntent with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DetectIntentRequest', ['session']); + request.session = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.detectIntent(request), expectedError); + }); + }); + + 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).calledWith(null)); + 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).calledWith(null)); + assert.deepStrictEqual(((stream as unknown as PassThrough) + ._transform as SinonStub).getCall(0).args[0], request); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('conversationDataset', () => { + const fakePath = "/rendered/path/conversationDataset"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_dataset: "conversationDatasetValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, "conversationDatasetValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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('projectConversationModel', () => { + const fakePath = "/rendered/path/projectConversationModel"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = client.matchConversationModelFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { + const fakePath = "/rendered/path/projectLocationConversationModel"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_versions_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_versions_v2.ts new file mode 100644 index 00000000000..c1d56d37b98 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_versions_v2.ts @@ -0,0 +1,2879 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.versionsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.versionsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.getVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVersion with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.GetVersionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getVersion(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateVersionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateVersionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateVersionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.createVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createVersion with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateVersionRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createVersion(request), expectedError); + }); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateVersionRequest', ['version', 'name']); + request.version.name = defaultValue1; + const expectedHeaderRequestParams = `version.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateVersionRequest', ['version', 'name']); + request.version.name = defaultValue1; + const expectedHeaderRequestParams = `version.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateVersionRequest', ['version', 'name']); + request.version.name = defaultValue1; + const expectedHeaderRequestParams = `version.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.updateVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateVersion with closed client', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateVersionRequest', ['version', 'name']); + request.version.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateVersion(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteVersion = stubSimpleCall(expectedResponse); + const [response] = await client.deleteVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteVersion with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteVersionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteVersion(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listVersions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listVersions(request), expectedError); + const actualRequest = (client.innerApiCalls.listVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('conversationDataset', () => { + const fakePath = "/rendered/path/conversationDataset"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_dataset: "conversationDatasetValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, "conversationDatasetValue"); + assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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('projectConversationModel', () => { + const fakePath = "/rendered/path/projectConversationModel"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = client.matchConversationModelFromProjectConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { + const fakePath = "/rendered/path/projectLocationConversationModel"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation_model: "conversationModelValue", + evaluation: "evaluationValue", + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "conversationModelValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); + assert.strictEqual(result, "evaluationValue"); + assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/tsconfig.json b/owl-bot-staging/google-cloud-dialogflow/v2/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/webpack.config.js b/owl-bot-staging/google-cloud-dialogflow/v2/webpack.config.js new file mode 100644 index 00000000000..0d2fc635111 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/.eslintignore b/owl-bot-staging/google-cloud-dialogflow/v2beta1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/.eslintrc.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/.gitignore b/owl-bot-staging/google-cloud-dialogflow/v2beta1/.gitignore new file mode 100644 index 00000000000..5d32b23782f --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/.jsdoc.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/.jsdoc.js new file mode 100644 index 00000000000..fe4bcaa346d --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2022 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 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/dialogflow', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/.mocharc.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/.mocharc.js new file mode 100644 index 00000000000..481c522b00f --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2022 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/google-cloud-dialogflow/v2beta1/.prettierrc.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/.prettierrc.js new file mode 100644 index 00000000000..494e147865d --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2022 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/google-cloud-dialogflow/v2beta1/README.md b/owl-bot-staging/google-cloud-dialogflow/v2beta1/README.md new file mode 100644 index 00000000000..f592662ac92 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/README.md @@ -0,0 +1 @@ +Dialogflow: Nodejs Client diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/linkinator.config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/package.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/package.json new file mode 100644 index 00000000000..e4beee27674 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/ && minifyProtoJson", + "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": "^3.5.2" + }, + "devDependencies": { + "@types/mocha": "^9.1.1", + "@types/node": "^16.11.62", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^3.6.11", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.0.3", + "mocha": "^10.0.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^14.0.0", + "ts-loader": "^8.4.0", + "typescript": "^4.8.3", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/agent.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/agent.proto new file mode 100644 index 00000000000..95b3933a6d4 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/agent.proto @@ -0,0 +1,578 @@ +// Copyright 2022 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/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. + // + // 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: "/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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // 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: "/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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: [ExportAgentResponse][google.cloud.dialogflow.v2beta1.ExportAgentResponse] + 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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // The operation only tracks when importing is complete, 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: "/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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // The operation only tracks when restoring is complete, 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: "/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; + + // Trial Edition, previously known as Standard Edition. + TIER_STANDARD = 1; + + // Essentials Edition, previously known as Enterprise Essential Edition. + TIER_ENTERPRISE = 2; + + // Essentials Edition (same as TIER_ENTERPRISE), previously known as + // Enterprise Plus Edition. + TIER_ENTERPRISE_PLUS = 3 [deprecated = true]; + } + + // 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. + // + // Dialogflow performs a write operation for the Cloud Storage object + // on the caller's behalf, so your request authentication must + // have write permissions for the object. For more information, see + // [Dialogflow access + // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + 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://". + // + // Dialogflow performs a read operation for the Cloud Storage object + // on the caller's behalf, so your request authentication must + // have read permissions for the object. For more information, see + // [Dialogflow access + // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + 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://". + // + // Dialogflow performs a read operation for the Cloud Storage object + // on the caller's behalf, so your request authentication must + // have read permissions for the object. For more information, see + // [Dialogflow access + // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + 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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/answer_record.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/answer_record.proto new file mode 100644 index 00000000000..1193f90c617 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/answer_record.proto @@ -0,0 +1,325 @@ +// Copyright 2022 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/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 { + // 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; + } + + // 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; + } + + // 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. Filters to restrict results to specific answer records. + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 2 [ + deprecated = true, + (google.api.field_behavior) = OPTIONAL + ]; + + // 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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/audio_config.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/audio_config.proto new file mode 100644 index 00000000000..b9e83b20bef --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/audio_config.proto @@ -0,0 +1,462 @@ +// Copyright 2022 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"; + +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"; +option (google.api.resource_definition) = { + type: "automl.googleapis.com/Model" + pattern: "projects/{project}/locations/{location}/models/{model}" +}; + +// 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; +} + +// 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; +} + +// 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; +} + +// 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; +} + +// 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; +} + +// 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; +} + +// 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; +} + +// 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; +} + +// [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; +} + +// A wrapper of repeated TelephonyDtmf digits. +message TelephonyDtmfEvents { + // A sequence of TelephonyDtmf digits. + repeated TelephonyDtmf dtmf_events = 1; +} + +// Configures speech transcription for +// [ConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfile]. +message SpeechToTextConfig { + // 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. If enhanced model variant is specified and an enhanced version of + // the specified model for the language does not exist, then it would emit an + // error. + SpeechModelVariant speech_model_variant = 1; + + // Which Speech model to select. Select the model best suited to your domain + // to get best results. If a model is not explicitly specified, then a default + // model is used. + // Refer to + // [Cloud Speech API + // documentation](https://cloud.google.com/speech-to-text/docs/basics#select-model) + // for more details. + string model = 2; +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/context.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/context.proto new file mode 100644 index 00000000000..a8e8c21f91f --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/context.proto @@ -0,0 +1,375 @@ +// Copyright 2022 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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation.proto new file mode 100644 index 00000000000..432d8c08024 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation.proto @@ -0,0 +1,494 @@ +// Copyright 2022 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/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 = "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"; + } + + // Suggest summary for a conversation based on specific historical messages. + // The range of the messages to be used for summary can be specified in the + // request. + rpc SuggestConversationSummary(SuggestConversationSummaryRequest) returns (SuggestConversationSummaryResponse) { + option (google.api.http) = { + post: "/v2beta1/{conversation=projects/*/conversations/*}/suggestions:suggestConversationSummary" + body: "*" + additional_bindings { + post: "/v2beta1/{conversation=projects/*/locations/*/conversations/*}/suggestions:suggestConversationSummary" + body: "*" + } + }; + option (google.api.method_signature) = "conversation"; + } +} + +// 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; +} + +// The request message for [Conversations.SuggestConversationSummary][google.cloud.dialogflow.v2beta1.Conversations.SuggestConversationSummary]. +message SuggestConversationSummaryRequest { + // Required. The conversation to fetch suggestion for. + // Format: `projects//locations//conversations/`. + string conversation = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Conversation" + } + ]; + + // The name of the latest conversation message used as context for + // compiling suggestion. If empty, the latest message of the conversation will + // be used. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 3 [(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 500 and at most 1000. + int32 context_size = 4; +} + +// The response message for [Conversations.SuggestConversationSummary][google.cloud.dialogflow.v2beta1.Conversations.SuggestConversationSummary]. +message SuggestConversationSummaryResponse { + // Generated summary for a conversation. + message Summary { + // The summary content that is concatenated into one string. + string text = 1; + + // The summary content that is divided into sections. The key is the + // section's name and the value is the section's content. There is no + // specific format for the key or value. + map text_sections = 4; + + // The name of the answer record. Format: + // "projects//answerRecords/" + string answer_record = 3 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/AnswerRecord" + }]; + } + + // Generated summary. + Summary summary = 1; + + // The name of the latest conversation message used as context for + // compiling suggestion. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Message" + }]; + + // Number of messages prior to and including + // [last_conversation_message][] used to compile the suggestion. It may be + // smaller than the [SuggestSummaryRequest.context_size][] field in the + // request if there weren't that many messages in the conversation. + int32 context_size = 3; +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_event.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_event.proto new file mode 100644 index 00000000000..7f47dcee08a --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_event.proto @@ -0,0 +1,85 @@ +// Copyright 2022 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"; + +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 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.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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto new file mode 100644 index 00000000000..0c1f5529620 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto @@ -0,0 +1,735 @@ +// Copyright 2022 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/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"; + } + + // Adds or updates a suggestion feature in a conversation profile. + // If the conversation profile contains the type of suggestion feature for + // the participant role, it will update it. Otherwise it will insert the + // suggestion feature. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [SetSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata] + // - `response`: [ConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfile] + // + // If a long running operation to add or update suggestion feature + // config for the same conversation profile, participant role and suggestion + // feature type exists, please cancel the existing long running operation + // before sending such request, otherwise the request will be rejected. + rpc SetSuggestionFeatureConfig(SetSuggestionFeatureConfigRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{conversation_profile=projects/*/conversationProfiles/*}:setSuggestionFeatureConfig" + body: "*" + additional_bindings { + post: "/v2beta1/{conversation_profile=projects/*/locations/*/conversationProfiles/*}:setSuggestionFeatureConfig" + body: "*" + } + }; + option (google.api.method_signature) = "conversation_profile"; + option (google.longrunning.operation_info) = { + response_type: "ConversationProfile" + metadata_type: "SetSuggestionFeatureConfigOperationMetadata" + }; + } + + // Clears a suggestion feature from a conversation profile for the given + // participant role. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [ClearSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata] + // - `response`: [ConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfile] + rpc ClearSuggestionFeatureConfig(ClearSuggestionFeatureConfigRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{conversation_profile=projects/*/conversationProfiles/*}:clearSuggestionFeatureConfig" + body: "*" + additional_bindings { + post: "/v2beta1/{conversation_profile=projects/*/locations/*/conversationProfiles/*}:clearSuggestionFeatureConfig" + body: "*" + } + }; + option (google.api.method_signature) = "conversation_profile"; + option (google.longrunning.operation_info) = { + response_type: "ConversationProfile" + metadata_type: "ClearSuggestionFeatureConfigOperationMetadata" + }; + } +} + +// 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. + // This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + // language tag. Example: "en-US". + string language_code = 10; + + // The time zone of this conversational profile from the + // [time zone database](https://www.iana.org/time-zones), e.g., + // America/New_York, Europe/Paris. Defaults to America/New_York. + string time_zone = 14; + + // Name of the CX SecuritySettings reference for the agent. + // Format: `projects//locations//securitySettings/`. + string security_settings = 13 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/CXSecuritySettings" + }]; +} + +// 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; + + // Configs for processing conversation. + ConversationProcessConfig conversation_process_config = 8; + } + + // 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, + // CONVERSATION_SUMMARIZATION. + message ConversationModelConfig { + // Conversation model resource name. Format: `projects//conversationModels/`. + string model = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationModel" + }]; + } + + // Config to process conversation. + message ConversationProcessConfig { + // Number of recent non-small-talk sentences to use as context for article + // and FAQ suggestion + int32 recent_sentences_count = 2; + } + + // 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. + // + // For telephony integration to receive notification, make sure either this + // topic 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. + // + // For chat integration to receive notification, make sure API caller has been + // granted the `Dialogflow Service Agent` role for the topic. + // + // 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" + } + ]; +} + +// The request message for +// [ConversationProfiles.SetSuggestionFeature][]. +message SetSuggestionFeatureConfigRequest { + // Required. The Conversation Profile to add or update the suggestion feature + // config. Format: `projects//locations//conversationProfiles/`. + string conversation_profile = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The participant role to add or update the suggestion feature + // config. Only HUMAN_AGENT or END_USER can be used. + Participant.Role participant_role = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The suggestion feature config to add or update. + HumanAgentAssistantConfig.SuggestionFeatureConfig suggestion_feature_config = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [ConversationProfiles.ClearFeature][]. +message ClearSuggestionFeatureConfigRequest { + // Required. The Conversation Profile to add or update the suggestion feature + // config. Format: `projects//locations//conversationProfiles/`. + string conversation_profile = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The participant role to remove the suggestion feature + // config. Only HUMAN_AGENT or END_USER can be used. + Participant.Role participant_role = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The type of the suggestion feature to remove. + SuggestionFeature.Type suggestion_feature_type = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Metadata for a [ConversationProfile.SetSuggestionFeatureConfig][] +// operation. +message SetSuggestionFeatureConfigOperationMetadata { + // The resource name of the conversation profile. Format: + // `projects//locations//conversationProfiles/` + string conversation_profile = 1; + + // Required. The participant role to add or update the suggestion feature + // config. Only HUMAN_AGENT or END_USER can be used. + Participant.Role participant_role = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The type of the suggestion feature to add or update. + SuggestionFeature.Type suggestion_feature_type = 3 [(google.api.field_behavior) = REQUIRED]; + + // Timestamp whe the request was created. The time is measured on server side. + google.protobuf.Timestamp create_time = 4; +} + +// Metadata for a [ConversationProfile.ClearSuggestionFeatureConfig][] +// operation. +message ClearSuggestionFeatureConfigOperationMetadata { + // The resource name of the conversation profile. Format: + // `projects//locations//conversationProfiles/` + string conversation_profile = 1; + + // Required. The participant role to remove the suggestion feature + // config. Only HUMAN_AGENT or END_USER can be used. + Participant.Role participant_role = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The type of the suggestion feature to remove. + SuggestionFeature.Type suggestion_feature_type = 3 [(google.api.field_behavior) = REQUIRED]; + + // Timestamp whe the request was created. The time is measured on server side. + google.protobuf.Timestamp create_time = 4; +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/document.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/document.proto new file mode 100644 index 00000000000..9ecdb5fb54c --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/document.proto @@ -0,0 +1,612 @@ +// Copyright 2022 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/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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] + // - `response`: [Document][google.cloud.dialogflow.v2beta1.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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] + // - `response`: [ImportDocumentsResponse][google.cloud.dialogflow.v2beta1.ImportDocumentsResponse] + 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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // 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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] + // - `response`: [Document][google.cloud.dialogflow.v2beta1.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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] + // - `response`: [Document][google.cloud.dialogflow.v2beta1.Document] + // + // 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 knowledge type of document content. + enum KnowledgeType { + option allow_alias = true; + + // 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 document contains agent-facing Smart Reply entries. + AGENT_FACING_SMART_REPLY = 4; + + // The legacy enum for agent-facing smart reply feature. + SMART_REPLY = 4; + } + + // 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; + } + + // Possible states of the document + enum State { + // The document state is unspecified. + STATE_UNSPECIFIED = 0; + + // The document creation is in progress. + CREATING = 1; + + // The document is active and ready to use. + ACTIVE = 2; + + // The document updation is in progress. + UPDATING = 3; + + // The document is reloading. + RELOADING = 4; + + // The document deletion is in progress. + DELETING = 5; + } + + // 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. PERMISSION_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]; + + // Output only. The current state of the document. + State state = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// 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 related to the Export Data Operations (e.g. ExportDocument). +message ExportOperationMetadata { + // Cloud Storage file path of the exported data. + GcsDestination exported_gcs_destination = 1; +} + +// 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]; + + // The name of the knowledge base interacted with during the operation. + string knowledge_base = 3; + + // Additional metadata for the Knowledge operation. + oneof operation_metadata { + // Metadata for the Export Data Operation such as the destination of export. + ExportOperationMetadata export_operation_metadata = 4; + } +} + +// 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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/entity_type.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/entity_type.proto new file mode 100644 index 00000000000..7bffded54b6 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/entity_type.proto @@ -0,0 +1,639 @@ +// Copyright 2022 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. + // + // 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: "/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. + // + // 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: "/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. + // + // 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: "/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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: [BatchUpdateEntityTypesResponse][google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse] + // + // 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: "/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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // 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: "/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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // 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: "/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. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + 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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // 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: "/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}" + }; + + // 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; + } + + // 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; + } + + // 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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/environment.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/environment.proto new file mode 100644 index 00000000000..dd95cab9af3 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/environment.proto @@ -0,0 +1,372 @@ +// Copyright 2022 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, + (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.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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/fulfillment.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/fulfillment.proto new file mode 100644 index 00000000000..8efe32af2f0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/fulfillment.proto @@ -0,0 +1,180 @@ +// Copyright 2022 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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/gcs.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/gcs.proto new file mode 100644 index 00000000000..debb5786c06 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/gcs.proto @@ -0,0 +1,55 @@ +// Copyright 2022 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"; + +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; +} + +// Google Cloud Storage location for the output. +message GcsDestination { + // Required. The Google Cloud Storage URIs for the output. A URI is of the + // form: + // gs://bucket/object-prefix-or-name + // Whether a prefix or name is used depends on the use case. The requesting + // user must have "write-permission" to the bucket. + string uri = 1; +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto new file mode 100644 index 00000000000..9716f74e5b0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto @@ -0,0 +1,50 @@ +// Copyright 2022 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"; + +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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/intent.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/intent.proto new file mode 100644 index 00000000000..99e9cafd762 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/intent.proto @@ -0,0 +1,1453 @@ +// Copyright 2022 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/context.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "IntentProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// 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. + // + // 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: "/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. + // + // 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: "/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. + // + // 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: "/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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse] + // + // 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: "/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. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // 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: "/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 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; + } + + // Represents an example that the agent is trained on. + message TrainingPhrase { + // 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. + // Note: Template mode has been deprecated. Example mode is the only + // supported way to create new training phrases. If you have existing + // training phrases in template mode, they will be removed during training + // and it can cause a drop in agent performance. + TEMPLATE = 2 [deprecated = true]; + } + + // 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; + } + + // 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 { + // 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; + } + + // 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 { + // Format of response media type. + enum ResponseMediaType { + // Unspecified. + RESPONSE_MEDIA_TYPE_UNSPECIFIED = 0; + + // Response media type is audio. + AUDIO = 1; + } + + // 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; + } + + // 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; + } + + // 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; + } + + // 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]; +} + +// 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; +} + +// This message is a wrapper around a collection of intents. +message IntentBatch { + // A collection of intents. + repeated Intent intents = 1; +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto new file mode 100644 index 00000000000..cf5c21ddee4 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto @@ -0,0 +1,278 @@ +// Copyright 2022 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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/participant.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/participant.proto new file mode 100644 index 00000000000..887a84015ce --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/participant.proto @@ -0,0 +1,1429 @@ +// Copyright 2022 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/session.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,audio_input"; + option (google.api.method_signature) = "participant,event_input"; + } + + // Adds a text (e.g., chat) or audio (e.g., phone recording) message from a + // participant into the conversation. + // Note: This method is only available through the gRPC API (not REST). + // + // The top-level message sent to the client by the server is + // `StreamingAnalyzeContentResponse`. Multiple response messages can be + // returned in order. The first one or more messages contain the + // `recognition_result` field. Each result represents a more complete + // transcript of what the user said. The next message contains the + // `reply_text` field, and potentially the `reply_audio` and/or the + // `automated_agent_reply` fields. + // + // 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 StreamingAnalyzeContent(stream StreamingAnalyzeContentRequest) returns (stream StreamingAnalyzeContentResponse) { + } + + // 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]; + + // Optional. Key-value filters on the metadata of documents returned by article + // suggestion. If specified, article suggestion only returns suggested + // documents that match all filters in their [Document.metadata][google.cloud.dialogflow.v2beta1.Document.metadata]. Multiple + // values for a metadata key should be concatenated by comma. For example, + // filters to match all documents that have 'US' or 'CA' in their market + // metadata values and 'agent' in their user metadata values will be + // ``` + // documents_metadata_filters { + // key: "market" + // value: "US,CA" + // } + // documents_metadata_filters { + // key: "user" + // value: "agent" + // } + // ``` + map documents_metadata_filters = 8 [(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 processed. +message AudioInput { + // Required. Instructs the speech recognizer how to process the speech audio. + InputAudioConfig config = 1; + + // Required. The natural language speech audio to be processed. + // A single request can contain up to 1 minute of speech audio data. + // The transcribed text cannot contain more than 256 bytes for virtual agent + // interactions. + bytes audio = 2; +} + +// 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 unique identifier of the current Dialogflow CX conversation page. + // Format: `projects//locations//agents//flows//pages/`. + string cx_current_page = 11; +} + +// 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 for chat. + ARTICLE_SUGGESTION = 1; + + // Run FAQ model. + FAQ = 2; + + // Run smart reply model for chat. + SMART_REPLY = 3; + + // Run conversation summarization model for chat. + CONVERSATION_SUMMARIZATION = 8; + } + + // Type of Human Agent Assistant API feature to request. + Type type = 1; +} + +// Represents the parameters of human assist query. +message AssistQueryParameters { + // Key-value filters on the metadata of documents returned by article + // suggestion. If specified, article suggestion only returns suggested + // documents that match all filters in their [Document.metadata][google.cloud.dialogflow.v2beta1.Document.metadata]. Multiple + // values for a metadata key should be concatenated by comma. For example, + // filters to match all documents that have 'US' or 'CA' in their market + // metadata values and 'agent' in their user metadata values will be + // ``` + // documents_metadata_filters { + // key: "market" + // value: "US,CA" + // } + // documents_metadata_filters { + // key: "user" + // value: "agent" + // } + // ``` + map documents_metadata_filters = 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; + + // The natural language speech audio to be processed. + AudioInput audio_input = 7; + + // 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; + + // Parameters for a human assist query. + AssistQueryParameters assist_query_params = 14; + + // Additional parameters to be put into Dialogflow CX session parameters. To + // remove a parameter from the session, clients should explicitly set the + // parameter value to null. + // + // Note: this field should only be used if you are connecting to a Dialogflow + // CX agent. + google.protobuf.Struct cx_parameters = 18; + + // The unique identifier of the CX page to override the `current_page` in the + // session. + // Format: `projects//locations//agents//flows//pages/`. + // + // If `cx_current_page` is specified, the previous state of the session will + // be ignored by Dialogflow CX, including the [previous + // page][QueryResult.current_page] and the [previous session + // parameters][QueryResult.parameters]. In most cases, `cx_current_page` and + // `cx_parameters` should be configured together to direct a session to a + // specific state. + // + // Note: this field should only be used if you are connecting to a Dialogflow + // CX agent. + string cx_current_page = 20; + + // 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]. + // + // Note that any failure of Agent Assist features will not lead to the overall + // failure of an AnalyzeContent API call. Instead, the features will + // fail silently with the error field set in the corresponding + // SuggestionResult. + 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]. + // + // Same as human_agent_suggestion_results, any failure of Agent Assist + // features will not lead to the overall failure of an AnalyzeContent API + // call. Instead, the features will fail silently with the error field set in + // the corresponding SuggestionResult. + repeated SuggestionResult end_user_suggestion_results = 7; + + // Indicates the parameters of DTMF. + DtmfParameters dtmf_parameters = 9; +} + +// Defines the language used in the input text. +message InputTextConfig { + // 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. + string language_code = 1; +} + +// The top-level message sent by the client to the +// [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent] method. +// +// Multiple request messages should be sent in order: +// +// 1. The first message must contain +// [participant][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.participant], +// [config][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.config] and optionally +// [query_params][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.query_params]. If you want +// to receive an audio response, it should also contain +// [reply_audio_config][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.reply_audio_config]. +// The message must not contain +// [input][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.input]. +// +// 2. If [config][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.config] in the first message +// was set to [audio_config][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.audio_config], +// all subsequent messages must contain +// [input_audio][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.input_audio] to continue +// with Speech recognition. +// If you decide to rather analyze text input after you already started +// Speech recognition, please send a message with +// [StreamingAnalyzeContentRequest.input_text][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.input_text]. +// +// However, note that: +// +// * Dialogflow will bill you for the audio so far. +// * Dialogflow discards all Speech recognition results in favor of the +// text input. +// +// 3. If [StreamingAnalyzeContentRequest.config][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.config] in the first message was set +// to [StreamingAnalyzeContentRequest.text_config][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.text_config], then the second message +// must contain only [input_text][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.input_text]. +// Moreover, you must not send more than two messages. +// +// After you sent all input, you must half-close or abort the request stream. +message StreamingAnalyzeContentRequest { + // 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 config. + oneof config { + // Instructs the speech recognizer how to process the speech audio. + InputAudioConfig audio_config = 2; + + // The natural language text to be processed. + InputTextConfig text_config = 3; + } + + // 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 + // StreamingAnalyzeContent. If this configuration is not supplied, speech + // synthesis is disabled. + OutputAudioConfig reply_audio_config = 4; + + // Required. The input. + oneof input { + // The input audio content to be recognized. Must be sent if `audio_config` + // is set in the first message. The complete audio over all streaming + // messages must not exceed 1 minute. + bytes input_audio = 5; + + // The UTF-8 encoded natural language text to be processed. Must be sent if + // `text_config` is set in the first message. Text length must not exceed + // 256 bytes for virtual agent interactions. The `input_text` field can be + // only sent once. + string input_text = 6; + + // The DTMF digits used to invoke intent and fill in parameter value. + // + // This input is ignored if the previous response indicated that DTMF input + // is not accepted. + TelephonyDtmfEvents input_dtmf = 9; + } + + // Parameters for a Dialogflow virtual-agent query. + QueryParameters query_params = 7; + + // Parameters for a human assist query. + AssistQueryParameters assist_query_params = 8; + + // Additional parameters to be put into Dialogflow CX session parameters. To + // remove a parameter from the session, clients should explicitly set the + // parameter value to null. + // + // Note: this field should only be used if you are connecting to a Dialogflow + // CX agent. + google.protobuf.Struct cx_parameters = 13; + + // The unique identifier of the CX page to override the `current_page` in the + // session. + // Format: `projects//locations//agents//flows//pages/`. + // + // If `cx_current_page` is specified, the previous state of the session will + // be ignored by Dialogflow CX, including the [previous + // page][QueryResult.current_page] and the [previous session + // parameters][QueryResult.parameters]. In most cases, `cx_current_page` and + // `cx_parameters` should be configured together to direct a session to a + // specific state. + // + // Note: this field should only be used if you are connecting to a Dialogflow + // CX agent. + string cx_current_page = 15; + + // Enable partial virtual agent responses. If this flag is not enabled, + // response stream still contains only one final response even if some + // `Fulfillment`s in Dialogflow virtual agent have been configured to return + // partial responses. + bool enable_partial_automated_agent_reply = 12; +} + +// The top-level message returned from the `StreamingAnalyzeContent` 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. In virtual agent stage: if `enable_partial_automated_agent_reply` is +// true, the following N (currently 1 <= N <= 4) messages +// contain `automated_agent_reply` and optionally `reply_audio` +// returned by the virtual agent. The first (N-1) +// `automated_agent_reply`s will have `automated_agent_reply_type` set to +// `PARTIAL`. The last `automated_agent_reply` has +// `automated_agent_reply_type` set to `FINAL`. +// If `enable_partial_automated_agent_reply` is not enabled, response stream +// only contains the final reply. +// +// In human assist stage: the following N (N >= 1) messages contain +// `human_agent_suggestion_results`, `end_user_suggestion_results` or +// `message`. +message StreamingAnalyzeContentResponse { + // The result of speech recognition. + StreamingRecognitionResult recognition_result = 1; + + // Optional. The output text content. + // This field is set if an automated agent responded with a text for the user. + string reply_text = 2; + + // Optional. The audio data bytes encoded as specified in the request. + // This field is set if: + // + // - The `reply_audio_config` field is specified in the request. + // - The automated agent, which this output comes from, responded with audio. + // In such case, the `reply_audio.config` field 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 = 3; + + // 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.StreamingAnalyzeContentResponse.reply_audio] instead. + AutomatedAgentReply automated_agent_reply = 4; + + // Output only. Message analyzed by CCAI. + Message message = 6; + + // 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 = 7; + + // 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 = 8; + + // Indicates the parameters of DTMF. + DtmfParameters dtmf_parameters = 10; +} + +// 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 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/AnswerRecord" + }]; +} + +// 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]; + + // Optional. Parameters for a human assist query. + AssistQueryParameters assist_query_params = 4 [(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]; + + // Optional. Parameters for a human assist query. + AssistQueryParameters assist_query_params = 4 [(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 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Message" + }]; + + // 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 { + + } + + // Represents an audio message that is composed of both segments + // synthesized from the Dialogflow agent prompts and ones hosted externally + // at the specified URIs. + message MixedAudio { + // Represents one segment of audio. + message Segment { + // Content of the segment. + oneof content { + // Raw audio synthesized from the Dialogflow agent's response using + // the output config specified in the request. + bytes audio = 1; + + // Client-specific URI that points to an audio clip accessible to the + // client. + string uri = 2; + } + + // Whether the playback of this segment can be interrupted by the end + // user's speech and the client should then start the next Dialogflow + // request. + bool allow_playback_interruption = 3; + } + + // Segments this audio response is composed of. + repeated Segment segments = 1; + } + + // Represents the signal that telles the client to transfer the phone call + // connected to the agent to a third-party endpoint. + message TelephonyTransferCall { + // Endpoint to transfer the call to. + oneof endpoint { + // Transfer the call to a phone number + // in [E.164 format](https://en.wikipedia.org/wiki/E.164). + string phone_number = 1; + + // Transfer the call to a SIP endpoint. + string sip_uri = 2; + } + } + + // 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; + + // An audio response message composed of both the synthesized Dialogflow + // agent responses and the audios hosted in places known to the client. + MixedAudio mixed_audio = 5; + + // A signal that the client should transfer the phone call connected to + // this agent to a third-party endpoint. + TelephonyTransferCall telephony_transfer_call = 6; + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/session.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/session.proto new file mode 100644 index 00000000000..4f45bce45bb --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/session.proto @@ -0,0 +1,841 @@ +// Copyright 2022 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/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. + // + // If you might use + // [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) + // or other CCAI products now or in the future, consider using + // [AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent] + // instead of `DetectIntent`. `AnalyzeContent` has additional + // functionality for Agent Assist and other CCAI products. + // + // 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). + // + // If you might use + // [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) + // or other CCAI products now or in the future, consider using + // [StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent] + // instead of `StreamingDetectIntent`. `StreamingAnalyzeContent` has + // additional functionality for Agent Assist and other CCAI products. + // + // 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. For more information, see the [cancel slot filling + // documentation](https://cloud.google.com/dialogflow/es/docs/intents-actions-parameters#cancel). + 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 `StreamingDetectIntentRequest.input_audio` field was +// set, the `recognition_result` field is populated for one +// or more messages. +// See the [StreamingRecognitionResult][google.cloud.dialogflow.v2beta1.StreamingRecognitionResult] message for details +// about the result message sequence. +// +// 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. +// +// While end-user audio is being processed, Dialogflow sends a series of +// results. Each result may contain a `transcript` value. A transcript +// represents a portion of the utterance. While the recognizer is processing +// audio, transcript values may be interim values or finalized values. +// Once a transcript is finalized, the `is_final` value is set to true and +// processing continues for the next transcript. +// +// If `StreamingDetectIntentRequest.query_input.audio_config.single_utterance` +// was true, and the recognizer has completed processing audio, +// the `message_type` value is set to `END_OF_SINGLE_UTTERANCE and the +// following (last) result contains the last finalized transcript. +// +// The complete end-user utterance is determined by concatenating the +// finalized transcript values received for the series of results. +// +// In the following example, single utterance is enabled. In the case where +// single utterance is not enabled, result 7 would not occur. +// +// ``` +// Num | transcript | message_type | is_final +// --- | ----------------------- | ----------------------- | -------- +// 1 | "tube" | TRANSCRIPT | false +// 2 | "to be a" | TRANSCRIPT | false +// 3 | "to be" | TRANSCRIPT | false +// 4 | "to be or not to be" | TRANSCRIPT | true +// 5 | "that's" | TRANSCRIPT | false +// 6 | "that is | TRANSCRIPT | false +// 7 | unset | END_OF_SINGLE_UTTERANCE | unset +// 8 | " that is the question" | TRANSCRIPT | true +// ``` +// +// Concatenating the finalized transcripts with `is_final` set to true, +// the complete utterance becomes "to be or not to be that is the question". +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; + + // Detected language code for the transcript. + string language_code = 10; + + // 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 for virtual agent interactions. + 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. + // + // This field is ignored when used in the context of a + // [WebhookResponse.followup_event_input][google.cloud.dialogflow.v2beta1.WebhookResponse.followup_event_input] field, + // because the language was already defined in the originating detect + // intent request. + 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. See: +// https://cloud.google.com/natural-language/docs/basics#interpreting_sentiment_analysis_values +// for how to interpret the result. +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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto new file mode 100644 index 00000000000..4b1c5873d26 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto @@ -0,0 +1,351 @@ +// Copyright 2022 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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/validation_result.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/validation_result.proto new file mode 100644 index 00000000000..d3882b9fae2 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/validation_result.proto @@ -0,0 +1,74 @@ +// Copyright 2022 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; + +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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/version.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/version.proto new file mode 100644 index 00000000000..58b4b5bbf71 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/version.proto @@ -0,0 +1,261 @@ +// Copyright 2022 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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/webhook.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/webhook.proto new file mode 100644 index 00000000000..a566c5ccc8e --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/webhook.proto @@ -0,0 +1,164 @@ +// Copyright 2022 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"; + +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/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.delete_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.delete_agent.js new file mode 100644 index 00000000000..7568a097c38 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.delete_agent.js @@ -0,0 +1,63 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Agents_DeleteAgent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent to delete is associated with. + * Format: `projects/` or + * `projects//locations/`. + */ + // const parent = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callDeleteAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.deleteAgent(request); + console.log(response); + } + + callDeleteAgent(); + // [END dialogflow_v2beta1_generated_Agents_DeleteAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.export_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.export_agent.js new file mode 100644 index 00000000000..bcfceaf88ab --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.export_agent.js @@ -0,0 +1,77 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Agents_ExportAgent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent to export is associated with. + * Format: `projects/` or + * `projects//locations/`. + */ + // const parent = 'abc123' + /** + * 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. + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * Dialogflow access + * control (https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + */ + // const agentUri = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callExportAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.exportAgent(request); + const [response] = await operation.promise(); + console.log(response); + } + + callExportAgent(); + // [END dialogflow_v2beta1_generated_Agents_ExportAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.get_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.get_agent.js new file mode 100644 index 00000000000..a6bca6a47b6 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.get_agent.js @@ -0,0 +1,63 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Agents_GetAgent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent to fetch is associated with. + * Format: `projects/` or + * `projects//locations/`. + */ + // const parent = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callGetAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.getAgent(request); + console.log(response); + } + + callGetAgent(); + // [END dialogflow_v2beta1_generated_Agents_GetAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.get_validation_result.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.get_validation_result.js new file mode 100644 index 00000000000..2b0ded3b158 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.get_validation_result.js @@ -0,0 +1,71 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Agents_GetValidationResult_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent is associated with. + * Format: `projects/` or + * `projects//locations/`. + */ + // const parent = 'abc123' + /** + * 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. + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callGetValidationResult() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.getValidationResult(request); + console.log(response); + } + + callGetValidationResult(); + // [END dialogflow_v2beta1_generated_Agents_GetValidationResult_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.import_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.import_agent.js new file mode 100644 index 00000000000..0e5cc2a7e94 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.import_agent.js @@ -0,0 +1,78 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Agents_ImportAgent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent to import is associated with. + * Format: `projects/` or + * `projects//locations/`. + */ + // const parent = 'abc123' + /** + * The URI to a Google Cloud Storage file containing the agent to import. + * Note: The URI must start with "gs://". + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * Dialogflow access + * control (https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + */ + // const agentUri = 'abc123' + /** + * Zip compressed raw byte content for agent. + */ + // const agentContent = 'Buffer.from('string')' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callImportAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.importAgent(request); + const [response] = await operation.promise(); + console.log(response); + } + + callImportAgent(); + // [END dialogflow_v2beta1_generated_Agents_ImportAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.restore_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.restore_agent.js new file mode 100644 index 00000000000..827e0e509eb --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.restore_agent.js @@ -0,0 +1,78 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Agents_RestoreAgent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent to restore is associated with. + * Format: `projects/` or + * `projects//locations/`. + */ + // const parent = 'abc123' + /** + * The URI to a Google Cloud Storage file containing the agent to restore. + * Note: The URI must start with "gs://". + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * Dialogflow access + * control (https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + */ + // const agentUri = 'abc123' + /** + * Zip compressed raw byte content for agent. + */ + // const agentContent = 'Buffer.from('string')' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callRestoreAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.restoreAgent(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRestoreAgent(); + // [END dialogflow_v2beta1_generated_Agents_RestoreAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.search_agents.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.search_agents.js new file mode 100644 index 00000000000..55792ca6aee --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.search_agents.js @@ -0,0 +1,74 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Agents_SearchAgents_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to list agents from. + * Format: `projects/` or + * `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callSearchAgents() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.searchAgentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callSearchAgents(); + // [END dialogflow_v2beta1_generated_Agents_SearchAgents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.set_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.set_agent.js new file mode 100644 index 00000000000..09788da9aa9 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.set_agent.js @@ -0,0 +1,65 @@ +// Copyright 2022 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'; + +function main(agent) { + // [START dialogflow_v2beta1_generated_Agents_SetAgent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to update. + */ + // const agent = {} + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callSetAgent() { + // Construct request + const request = { + agent, + }; + + // Run request + const response = await dialogflowClient.setAgent(request); + console.log(response); + } + + callSetAgent(); + // [END dialogflow_v2beta1_generated_Agents_SetAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.train_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.train_agent.js new file mode 100644 index 00000000000..4451ade78cf --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.train_agent.js @@ -0,0 +1,64 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Agents_TrainAgent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent to train is associated with. + * Format: `projects/` or + * `projects//locations/`. + */ + // const parent = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callTrainAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.trainAgent(request); + const [response] = await operation.promise(); + console.log(response); + } + + callTrainAgent(); + // [END dialogflow_v2beta1_generated_Agents_TrainAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/answer_records.get_answer_record.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/answer_records.get_answer_record.js new file mode 100644 index 00000000000..246fb647b86 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/answer_records.get_answer_record.js @@ -0,0 +1,62 @@ +// Copyright 2022 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'; + +function main() { + // [START dialogflow_v2beta1_generated_AnswerRecords_GetAnswerRecord_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the answer record to retrieve. + * Format: `projects//locations//answerRecords/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {AnswerRecordsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AnswerRecordsClient(); + + async function callGetAnswerRecord() { + // Construct request + const request = { + }; + + // Run request + const response = await dialogflowClient.getAnswerRecord(request); + console.log(response); + } + + callGetAnswerRecord(); + // [END dialogflow_v2beta1_generated_AnswerRecords_GetAnswerRecord_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/answer_records.list_answer_records.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/answer_records.list_answer_records.js new file mode 100644 index 00000000000..6e8f2d41f58 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/answer_records.list_answer_records.js @@ -0,0 +1,83 @@ +// Copyright 2022 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'; + +function main() { + // [START dialogflow_v2beta1_generated_AnswerRecords_ListAnswerRecords_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to list all answer records for in reverse + * chronological order. Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Optional. Filters to restrict results to specific answer records. + * For more information about filtering, see + * API Filtering (https://aip.dev/160). + */ + // const filter = 'abc123' + /** + * 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. + */ + // const pageSize = 1234 + /** + * 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. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {AnswerRecordsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AnswerRecordsClient(); + + async function callListAnswerRecords() { + // Construct request + const request = { + }; + + // Run request + const iterable = await dialogflowClient.listAnswerRecordsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAnswerRecords(); + // [END dialogflow_v2beta1_generated_AnswerRecords_ListAnswerRecords_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/answer_records.update_answer_record.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/answer_records.update_answer_record.js new file mode 100644 index 00000000000..904438926c3 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/answer_records.update_answer_record.js @@ -0,0 +1,65 @@ +// Copyright 2022 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'; + +function main(answerRecord) { + // [START dialogflow_v2beta1_generated_AnswerRecords_UpdateAnswerRecord_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Answer record to update. + */ + // const answerRecord = {} + /** + * Required. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {AnswerRecordsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AnswerRecordsClient(); + + async function callUpdateAnswerRecord() { + // Construct request + const request = { + answerRecord, + }; + + // Run request + const response = await dialogflowClient.updateAnswerRecord(request); + console.log(response); + } + + callUpdateAnswerRecord(); + // [END dialogflow_v2beta1_generated_AnswerRecords_UpdateAnswerRecord_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.create_context.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.create_context.js new file mode 100644 index 00000000000..f75ab2546eb --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.create_context.js @@ -0,0 +1,77 @@ +// Copyright 2022 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'; + +function main(parent, context) { + // [START dialogflow_v2beta1_generated_Contexts_CreateContext_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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. + */ + // const parent = 'abc123' + /** + * Required. The context to create. + */ + // const context = {} + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function callCreateContext() { + // Construct request + const request = { + parent, + context, + }; + + // Run request + const response = await dialogflowClient.createContext(request); + console.log(response); + } + + callCreateContext(); + // [END dialogflow_v2beta1_generated_Contexts_CreateContext_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.delete_all_contexts.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.delete_all_contexts.js new file mode 100644 index 00000000000..5d804090ffc --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.delete_all_contexts.js @@ -0,0 +1,72 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Contexts_DeleteAllContexts_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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. + */ + // const parent = 'abc123' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function callDeleteAllContexts() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.deleteAllContexts(request); + console.log(response); + } + + callDeleteAllContexts(); + // [END dialogflow_v2beta1_generated_Contexts_DeleteAllContexts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.delete_context.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.delete_context.js new file mode 100644 index 00000000000..358c10041f9 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.delete_context.js @@ -0,0 +1,73 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Contexts_DeleteContext_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function callDeleteContext() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteContext(request); + console.log(response); + } + + callDeleteContext(); + // [END dialogflow_v2beta1_generated_Contexts_DeleteContext_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.get_context.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.get_context.js new file mode 100644 index 00000000000..900998726cc --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.get_context.js @@ -0,0 +1,73 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Contexts_GetContext_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function callGetContext() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getContext(request); + console.log(response); + } + + callGetContext(); + // [END dialogflow_v2beta1_generated_Contexts_GetContext_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.list_contexts.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.list_contexts.js new file mode 100644 index 00000000000..64fabb5b2cb --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.list_contexts.js @@ -0,0 +1,83 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Contexts_ListContexts_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function callListContexts() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listContextsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListContexts(); + // [END dialogflow_v2beta1_generated_Contexts_ListContexts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.update_context.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.update_context.js new file mode 100644 index 00000000000..b8670e512db --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.update_context.js @@ -0,0 +1,65 @@ +// Copyright 2022 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'; + +function main(context) { + // [START dialogflow_v2beta1_generated_Contexts_UpdateContext_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The context to update. + */ + // const context = {} + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function callUpdateContext() { + // Construct request + const request = { + context, + }; + + // Run request + const response = await dialogflowClient.updateContext(request); + console.log(response); + } + + callUpdateContext(); + // [END dialogflow_v2beta1_generated_Contexts_UpdateContext_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.clear_suggestion_feature_config.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.clear_suggestion_feature_config.js new file mode 100644 index 00000000000..46ab5c9bc5f --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.clear_suggestion_feature_config.js @@ -0,0 +1,75 @@ +// Copyright 2022 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'; + +function main(conversationProfile, participantRole, suggestionFeatureType) { + // [START dialogflow_v2beta1_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The Conversation Profile to add or update the suggestion feature + * config. Format: `projects//locations//conversationProfiles/`. + */ + // const conversationProfile = 'abc123' + /** + * Required. The participant role to remove the suggestion feature + * config. Only HUMAN_AGENT or END_USER can be used. + */ + // const participantRole = {} + /** + * Required. The type of the suggestion feature to remove. + */ + // const suggestionFeatureType = {} + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callClearSuggestionFeatureConfig() { + // Construct request + const request = { + conversationProfile, + participantRole, + suggestionFeatureType, + }; + + // Run request + const [operation] = await dialogflowClient.clearSuggestionFeatureConfig(request); + const [response] = await operation.promise(); + console.log(response); + } + + callClearSuggestionFeatureConfig(); + // [END dialogflow_v2beta1_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.create_conversation_profile.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.create_conversation_profile.js new file mode 100644 index 00000000000..2aa68468163 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.create_conversation_profile.js @@ -0,0 +1,67 @@ +// Copyright 2022 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'; + +function main(parent, conversationProfile) { + // [START dialogflow_v2beta1_generated_ConversationProfiles_CreateConversationProfile_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to create a conversation profile for. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Required. The conversation profile to create. + */ + // const conversationProfile = {} + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callCreateConversationProfile() { + // Construct request + const request = { + parent, + conversationProfile, + }; + + // Run request + const response = await dialogflowClient.createConversationProfile(request); + console.log(response); + } + + callCreateConversationProfile(); + // [END dialogflow_v2beta1_generated_ConversationProfiles_CreateConversationProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.delete_conversation_profile.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.delete_conversation_profile.js new file mode 100644 index 00000000000..ed1539ec95a --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.delete_conversation_profile.js @@ -0,0 +1,63 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2beta1_generated_ConversationProfiles_DeleteConversationProfile_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the conversation profile to delete. + * Format: `projects//locations//conversationProfiles/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callDeleteConversationProfile() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteConversationProfile(request); + console.log(response); + } + + callDeleteConversationProfile(); + // [END dialogflow_v2beta1_generated_ConversationProfiles_DeleteConversationProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.get_conversation_profile.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.get_conversation_profile.js new file mode 100644 index 00000000000..d46d62ae134 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.get_conversation_profile.js @@ -0,0 +1,63 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2beta1_generated_ConversationProfiles_GetConversationProfile_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the conversation profile. + * Format: `projects//locations//conversationProfiles/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callGetConversationProfile() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getConversationProfile(request); + console.log(response); + } + + callGetConversationProfile(); + // [END dialogflow_v2beta1_generated_ConversationProfiles_GetConversationProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.list_conversation_profiles.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.list_conversation_profiles.js new file mode 100644 index 00000000000..c61024a3c87 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.list_conversation_profiles.js @@ -0,0 +1,73 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_ConversationProfiles_ListConversationProfiles_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to list all conversation profiles from. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callListConversationProfiles() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listConversationProfilesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListConversationProfiles(); + // [END dialogflow_v2beta1_generated_ConversationProfiles_ListConversationProfiles_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.set_suggestion_feature_config.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.set_suggestion_feature_config.js new file mode 100644 index 00000000000..5823e47f213 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.set_suggestion_feature_config.js @@ -0,0 +1,75 @@ +// Copyright 2022 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'; + +function main(conversationProfile, participantRole, suggestionFeatureConfig) { + // [START dialogflow_v2beta1_generated_ConversationProfiles_SetSuggestionFeatureConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The Conversation Profile to add or update the suggestion feature + * config. Format: `projects//locations//conversationProfiles/`. + */ + // const conversationProfile = 'abc123' + /** + * Required. The participant role to add or update the suggestion feature + * config. Only HUMAN_AGENT or END_USER can be used. + */ + // const participantRole = {} + /** + * Required. The suggestion feature config to add or update. + */ + // const suggestionFeatureConfig = {} + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callSetSuggestionFeatureConfig() { + // Construct request + const request = { + conversationProfile, + participantRole, + suggestionFeatureConfig, + }; + + // Run request + const [operation] = await dialogflowClient.setSuggestionFeatureConfig(request); + const [response] = await operation.promise(); + console.log(response); + } + + callSetSuggestionFeatureConfig(); + // [END dialogflow_v2beta1_generated_ConversationProfiles_SetSuggestionFeatureConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.update_conversation_profile.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.update_conversation_profile.js new file mode 100644 index 00000000000..78ea9ed9bda --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.update_conversation_profile.js @@ -0,0 +1,66 @@ +// Copyright 2022 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'; + +function main(conversationProfile, updateMask) { + // [START dialogflow_v2beta1_generated_ConversationProfiles_UpdateConversationProfile_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The conversation profile to update. + */ + // const conversationProfile = {} + /** + * Required. The mask to control which fields to update. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callUpdateConversationProfile() { + // Construct request + const request = { + conversationProfile, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateConversationProfile(request); + console.log(response); + } + + callUpdateConversationProfile(); + // [END dialogflow_v2beta1_generated_ConversationProfiles_UpdateConversationProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.batch_create_messages.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.batch_create_messages.js new file mode 100644 index 00000000000..23afc4a719a --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.batch_create_messages.js @@ -0,0 +1,70 @@ +// Copyright 2022 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'; + +function main(parent, requests) { + // [START dialogflow_v2beta1_generated_Conversations_BatchCreateMessages_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource identifier of the conversation to create message. + * Format: `projects//locations//conversations/`. + */ + // const parent = 'abc123' + /** + * 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. + */ + // const requests = 1234 + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callBatchCreateMessages() { + // Construct request + const request = { + parent, + requests, + }; + + // Run request + const response = await dialogflowClient.batchCreateMessages(request); + console.log(response); + } + + callBatchCreateMessages(); + // [END dialogflow_v2beta1_generated_Conversations_BatchCreateMessages_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.complete_conversation.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.complete_conversation.js new file mode 100644 index 00000000000..a7af3e43013 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.complete_conversation.js @@ -0,0 +1,63 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Conversations_CompleteConversation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource identifier of the conversation to close. + * Format: `projects//locations//conversations/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callCompleteConversation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.completeConversation(request); + console.log(response); + } + + callCompleteConversation(); + // [END dialogflow_v2beta1_generated_Conversations_CompleteConversation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.create_conversation.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.create_conversation.js new file mode 100644 index 00000000000..c6f79f3c11f --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.create_conversation.js @@ -0,0 +1,79 @@ +// Copyright 2022 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'; + +function main(parent, conversation) { + // [START dialogflow_v2beta1_generated_Conversations_CreateConversation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource identifier of the project creating the conversation. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Required. The conversation to create. + */ + // const conversation = {} + /** + * 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. + */ + // const conversationId = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callCreateConversation() { + // Construct request + const request = { + parent, + conversation, + }; + + // Run request + const response = await dialogflowClient.createConversation(request); + console.log(response); + } + + callCreateConversation(); + // [END dialogflow_v2beta1_generated_Conversations_CreateConversation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.get_conversation.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.get_conversation.js new file mode 100644 index 00000000000..e408a83384a --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.get_conversation.js @@ -0,0 +1,63 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Conversations_GetConversation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the conversation. Format: + * `projects//locations//conversations/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callGetConversation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getConversation(request); + console.log(response); + } + + callGetConversation(); + // [END dialogflow_v2beta1_generated_Conversations_GetConversation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.list_conversations.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.list_conversations.js new file mode 100644 index 00000000000..81e76c97e9c --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.list_conversations.js @@ -0,0 +1,91 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Conversations_ListConversations_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project from which to list all conversation. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + /** + * 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). + */ + // const filter = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callListConversations() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listConversationsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListConversations(); + // [END dialogflow_v2beta1_generated_Conversations_ListConversations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.list_messages.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.list_messages.js new file mode 100644 index 00000000000..239e3bff07c --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.list_messages.js @@ -0,0 +1,84 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Conversations_ListMessages_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the conversation to list messages for. + * Format: `projects//locations//conversations/` + */ + // const parent = 'abc123' + /** + * 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). + */ + // const filter = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callListMessages() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listMessagesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListMessages(); + // [END dialogflow_v2beta1_generated_Conversations_ListMessages_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.suggest_conversation_summary.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.suggest_conversation_summary.js new file mode 100644 index 00000000000..18d9ac2df60 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.suggest_conversation_summary.js @@ -0,0 +1,77 @@ +// Copyright 2022 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'; + +function main(conversation) { + // [START dialogflow_v2beta1_generated_Conversations_SuggestConversationSummary_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The conversation to fetch suggestion for. + * Format: `projects//locations//conversations/`. + */ + // const conversation = 'abc123' + /** + * The name of the latest conversation message used as context for + * compiling suggestion. If empty, the latest message of the conversation will + * be used. + * Format: `projects//locations//conversations//messages/`. + */ + // const latestMessage = 'abc123' + /** + * Max number of messages prior to and including + * latest_message to use as context when compiling the + * suggestion. By default 500 and at most 1000. + */ + // const contextSize = 1234 + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callSuggestConversationSummary() { + // Construct request + const request = { + conversation, + }; + + // Run request + const response = await dialogflowClient.suggestConversationSummary(request); + console.log(response); + } + + callSuggestConversationSummary(); + // [END dialogflow_v2beta1_generated_Conversations_SuggestConversationSummary_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.create_document.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.create_document.js new file mode 100644 index 00000000000..d552bdb3c21 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.create_document.js @@ -0,0 +1,74 @@ +// Copyright 2022 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'; + +function main(parent, document) { + // [START dialogflow_v2beta1_generated_Documents_CreateDocument_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The knowledge base to create a document for. + * Format: `projects//locations//knowledgeBases/`. + */ + // const parent = 'abc123' + /** + * Required. The document to create. + */ + // const document = {} + /** + * Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + */ + // const importGcsCustomMetadata = true + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callCreateDocument() { + // Construct request + const request = { + parent, + document, + }; + + // Run request + const [operation] = await dialogflowClient.createDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateDocument(); + // [END dialogflow_v2beta1_generated_Documents_CreateDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.delete_document.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.delete_document.js new file mode 100644 index 00000000000..db20422b45e --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.delete_document.js @@ -0,0 +1,64 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Documents_DeleteDocument_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the document to delete. + * Format: `projects//locations//knowledgeBases//documents/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callDeleteDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await dialogflowClient.deleteDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteDocument(); + // [END dialogflow_v2beta1_generated_Documents_DeleteDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.get_document.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.get_document.js new file mode 100644 index 00000000000..2388357475b --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.get_document.js @@ -0,0 +1,63 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Documents_GetDocument_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the document to retrieve. + * Format `projects//locations//knowledgeBases//documents/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callGetDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getDocument(request); + console.log(response); + } + + callGetDocument(); + // [END dialogflow_v2beta1_generated_Documents_GetDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.import_documents.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.import_documents.js new file mode 100644 index 00000000000..3f6bf3e843a --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.import_documents.js @@ -0,0 +1,82 @@ +// Copyright 2022 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'; + +function main(parent, documentTemplate) { + // [START dialogflow_v2beta1_generated_Documents_ImportDocuments_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The knowledge base to import documents into. + * Format: `projects//locations//knowledgeBases/`. + */ + // const parent = 'abc123' + /** + * The Google Cloud Storage location for the documents. + * The path can include a wildcard. + * These URIs may have the forms + * `gs:///`. + * `gs:////*.`. + */ + // const gcsSource = {} + /** + * Required. Document template used for importing all the documents. + */ + // const documentTemplate = {} + /** + * Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + */ + // const importGcsCustomMetadata = true + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callImportDocuments() { + // Construct request + const request = { + parent, + documentTemplate, + }; + + // Run request + const [operation] = await dialogflowClient.importDocuments(request); + const [response] = await operation.promise(); + console.log(response); + } + + callImportDocuments(); + // [END dialogflow_v2beta1_generated_Documents_ImportDocuments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.list_documents.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.list_documents.js new file mode 100644 index 00000000000..af65dd941f5 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.list_documents.js @@ -0,0 +1,92 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Documents_ListDocuments_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The knowledge base to list all documents for. + * Format: `projects//locations//knowledgeBases/`. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return in a single page. By + * default 10 and at most 100. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + /** + * 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). + */ + // const filter = 'abc123' + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callListDocuments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listDocumentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListDocuments(); + // [END dialogflow_v2beta1_generated_Documents_ListDocuments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.reload_document.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.reload_document.js new file mode 100644 index 00000000000..f1e5778505f --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.reload_document.js @@ -0,0 +1,74 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Documents_ReloadDocument_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the document to reload. + * Format: `projects//locations//knowledgeBases//documents/` + */ + // const name = 'abc123' + /** + * The path for a Cloud Storage source file for reloading document content. + * If not provided, the Document's existing source will be reloaded. + */ + // const gcsSource = {} + /** + * Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + */ + // const importGcsCustomMetadata = true + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callReloadDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await dialogflowClient.reloadDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + callReloadDocument(); + // [END dialogflow_v2beta1_generated_Documents_ReloadDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.update_document.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.update_document.js new file mode 100644 index 00000000000..e46ab841b5a --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.update_document.js @@ -0,0 +1,68 @@ +// Copyright 2022 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'; + +function main(document) { + // [START dialogflow_v2beta1_generated_Documents_UpdateDocument_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The document to update. + */ + // const document = {} + /** + * Optional. Not specified means `update all`. + * Currently, only `display_name` can be updated, an InvalidArgument will be + * returned for attempting to update other fields. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callUpdateDocument() { + // Construct request + const request = { + document, + }; + + // Run request + const [operation] = await dialogflowClient.updateDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateDocument(); + // [END dialogflow_v2beta1_generated_Documents_UpdateDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_create_entities.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_create_entities.js new file mode 100644 index 00000000000..db4da1cc2c9 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_create_entities.js @@ -0,0 +1,79 @@ +// Copyright 2022 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'; + +function main(parent, entities) { + // [START dialogflow_v2beta1_generated_EntityTypes_BatchCreateEntities_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the entity type to create entities in. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + */ + // const parent = 'abc123' + /** + * Required. The entities to create. + */ + // const entities = 1234 + /** + * 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). + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callBatchCreateEntities() { + // Construct request + const request = { + parent, + entities, + }; + + // Run request + const [operation] = await dialogflowClient.batchCreateEntities(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchCreateEntities(); + // [END dialogflow_v2beta1_generated_EntityTypes_BatchCreateEntities_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_delete_entities.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_delete_entities.js new file mode 100644 index 00000000000..ac62a1ce5c2 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_delete_entities.js @@ -0,0 +1,81 @@ +// Copyright 2022 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'; + +function main(parent, entityValues) { + // [START dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntities_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the entity type to delete entries for. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + */ + // const parent = 'abc123' + /** + * 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/`. + */ + // const entityValues = 'abc123' + /** + * 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). + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callBatchDeleteEntities() { + // Construct request + const request = { + parent, + entityValues, + }; + + // Run request + const [operation] = await dialogflowClient.batchDeleteEntities(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchDeleteEntities(); + // [END dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntities_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_delete_entity_types.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_delete_entity_types.js new file mode 100644 index 00000000000..caabef66668 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_delete_entity_types.js @@ -0,0 +1,71 @@ +// Copyright 2022 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'; + +function main(parent, entityTypeNames) { + // [START dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntityTypes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the agent to delete all entities types for. + * Supported formats: + * - `projects//agent`, + * - `projects//locations//agent`. + */ + // const parent = 'abc123' + /** + * Required. The names entity types to delete. All names must point to the + * same agent as `parent`. + */ + // const entityTypeNames = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callBatchDeleteEntityTypes() { + // Construct request + const request = { + parent, + entityTypeNames, + }; + + // Run request + const [operation] = await dialogflowClient.batchDeleteEntityTypes(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchDeleteEntityTypes(); + // [END dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntityTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_update_entities.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_update_entities.js new file mode 100644 index 00000000000..4a4c08803b3 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_update_entities.js @@ -0,0 +1,83 @@ +// Copyright 2022 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'; + +function main(parent, entities) { + // [START dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntities_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the entity type to update or create entities in. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + */ + // const parent = 'abc123' + /** + * Required. The entities to update or create. + */ + // const entities = 1234 + /** + * 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). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callBatchUpdateEntities() { + // Construct request + const request = { + parent, + entities, + }; + + // Run request + const [operation] = await dialogflowClient.batchUpdateEntities(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchUpdateEntities(); + // [END dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntities_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_update_entity_types.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_update_entity_types.js new file mode 100644 index 00000000000..0ac513a6d9a --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_update_entity_types.js @@ -0,0 +1,88 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntityTypes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the agent to update or create entity types in. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * 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://". + */ + // const entityTypeBatchUri = 'abc123' + /** + * The collection of entity types to update or create. + */ + // const entityTypeBatchInline = {} + /** + * 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). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callBatchUpdateEntityTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.batchUpdateEntityTypes(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchUpdateEntityTypes(); + // [END dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntityTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.create_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.create_entity_type.js new file mode 100644 index 00000000000..97aba8a357c --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.create_entity_type.js @@ -0,0 +1,77 @@ +// Copyright 2022 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'; + +function main(parent, entityType) { + // [START dialogflow_v2beta1_generated_EntityTypes_CreateEntityType_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to create a entity type for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Required. The entity type to create. + */ + // const 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). + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callCreateEntityType() { + // Construct request + const request = { + parent, + entityType, + }; + + // Run request + const response = await dialogflowClient.createEntityType(request); + console.log(response); + } + + callCreateEntityType(); + // [END dialogflow_v2beta1_generated_EntityTypes_CreateEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.delete_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.delete_entity_type.js new file mode 100644 index 00000000000..2bb6ad5c66c --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.delete_entity_type.js @@ -0,0 +1,65 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2beta1_generated_EntityTypes_DeleteEntityType_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the entity type to delete. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callDeleteEntityType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteEntityType(request); + console.log(response); + } + + callDeleteEntityType(); + // [END dialogflow_v2beta1_generated_EntityTypes_DeleteEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.get_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.get_entity_type.js new file mode 100644 index 00000000000..fd0b856a2e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.get_entity_type.js @@ -0,0 +1,73 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2beta1_generated_EntityTypes_GetEntityType_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the entity type. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + */ + // const name = 'abc123' + /** + * 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). + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callGetEntityType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getEntityType(request); + console.log(response); + } + + callGetEntityType(); + // [END dialogflow_v2beta1_generated_EntityTypes_GetEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.list_entity_types.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.list_entity_types.js new file mode 100644 index 00000000000..a2276da5bbc --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.list_entity_types.js @@ -0,0 +1,83 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_EntityTypes_ListEntityTypes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to list all entity types from. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * 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). + */ + // const languageCode = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callListEntityTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listEntityTypesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListEntityTypes(); + // [END dialogflow_v2beta1_generated_EntityTypes_ListEntityTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.update_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.update_entity_type.js new file mode 100644 index 00000000000..aa87205c946 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.update_entity_type.js @@ -0,0 +1,73 @@ +// Copyright 2022 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'; + +function main(entityType) { + // [START dialogflow_v2beta1_generated_EntityTypes_UpdateEntityType_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The entity type to update. + */ + // const 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). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callUpdateEntityType() { + // Construct request + const request = { + entityType, + }; + + // Run request + const response = await dialogflowClient.updateEntityType(request); + console.log(response); + } + + callUpdateEntityType(); + // [END dialogflow_v2beta1_generated_EntityTypes_UpdateEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.create_environment.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.create_environment.js new file mode 100644 index 00000000000..d1ac1e20e7c --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.create_environment.js @@ -0,0 +1,74 @@ +// Copyright 2022 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'; + +function main(parent, environment, environmentId) { + // [START dialogflow_v2beta1_generated_Environments_CreateEnvironment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to create an environment for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Required. The environment to create. + */ + // const environment = {} + /** + * Required. The unique id of the new environment. + */ + // const environmentId = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function callCreateEnvironment() { + // Construct request + const request = { + parent, + environment, + environmentId, + }; + + // Run request + const response = await dialogflowClient.createEnvironment(request); + console.log(response); + } + + callCreateEnvironment(); + // [END dialogflow_v2beta1_generated_Environments_CreateEnvironment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.delete_environment.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.delete_environment.js new file mode 100644 index 00000000000..03704937bf8 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.delete_environment.js @@ -0,0 +1,65 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Environments_DeleteEnvironment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the environment to delete. + * / Format: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function callDeleteEnvironment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteEnvironment(request); + console.log(response); + } + + callDeleteEnvironment(); + // [END dialogflow_v2beta1_generated_Environments_DeleteEnvironment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.get_environment.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.get_environment.js new file mode 100644 index 00000000000..086269c194d --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.get_environment.js @@ -0,0 +1,65 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Environments_GetEnvironment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the environment. + * Supported formats: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function callGetEnvironment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getEnvironment(request); + console.log(response); + } + + callGetEnvironment(); + // [END dialogflow_v2beta1_generated_Environments_GetEnvironment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.get_environment_history.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.get_environment_history.js new file mode 100644 index 00000000000..0fe14234de6 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.get_environment_history.js @@ -0,0 +1,76 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Environments_GetEnvironmentHistory_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the environment to retrieve history for. + * Supported formats: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function callGetEnvironmentHistory() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.getEnvironmentHistoryAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callGetEnvironmentHistory(); + // [END dialogflow_v2beta1_generated_Environments_GetEnvironmentHistory_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.list_environments.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.list_environments.js new file mode 100644 index 00000000000..b13bb94f6b6 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.list_environments.js @@ -0,0 +1,75 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Environments_ListEnvironments_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to list all environments from. + * Format: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function callListEnvironments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listEnvironmentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListEnvironments(); + // [END dialogflow_v2beta1_generated_Environments_ListEnvironments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.update_environment.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.update_environment.js new file mode 100644 index 00000000000..1c30a30ef3d --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.update_environment.js @@ -0,0 +1,73 @@ +// Copyright 2022 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'; + +function main(environment, updateMask) { + // [START dialogflow_v2beta1_generated_Environments_UpdateEnvironment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The environment to update. + */ + // const environment = {} + /** + * Required. The mask to control which fields get updated. + */ + // const updateMask = {} + /** + * 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 = `-`). + */ + // const allowLoadToDraftAndDiscardChanges = true + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function callUpdateEnvironment() { + // Construct request + const request = { + environment, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateEnvironment(request); + console.log(response); + } + + callUpdateEnvironment(); + // [END dialogflow_v2beta1_generated_Environments_UpdateEnvironment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/fulfillments.get_fulfillment.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/fulfillments.get_fulfillment.js new file mode 100644 index 00000000000..91cb58b2b60 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/fulfillments.get_fulfillment.js @@ -0,0 +1,64 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Fulfillments_GetFulfillment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the fulfillment. + * Supported formats: + * - `projects//agent/fulfillment` + * - `projects//locations//agent/fulfillment` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {FulfillmentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new FulfillmentsClient(); + + async function callGetFulfillment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getFulfillment(request); + console.log(response); + } + + callGetFulfillment(); + // [END dialogflow_v2beta1_generated_Fulfillments_GetFulfillment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/fulfillments.update_fulfillment.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/fulfillments.update_fulfillment.js new file mode 100644 index 00000000000..bb043db9083 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/fulfillments.update_fulfillment.js @@ -0,0 +1,67 @@ +// Copyright 2022 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'; + +function main(fulfillment, updateMask) { + // [START dialogflow_v2beta1_generated_Fulfillments_UpdateFulfillment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The fulfillment to update. + */ + // const fulfillment = {} + /** + * Required. The mask to control which fields get updated. If the mask is not + * present, all fields will be updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {FulfillmentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new FulfillmentsClient(); + + async function callUpdateFulfillment() { + // Construct request + const request = { + fulfillment, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateFulfillment(request); + console.log(response); + } + + callUpdateFulfillment(); + // [END dialogflow_v2beta1_generated_Fulfillments_UpdateFulfillment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.batch_delete_intents.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.batch_delete_intents.js new file mode 100644 index 00000000000..6aaec0ced80 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.batch_delete_intents.js @@ -0,0 +1,71 @@ +// Copyright 2022 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'; + +function main(parent, intents) { + // [START dialogflow_v2beta1_generated_Intents_BatchDeleteIntents_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the agent to delete all entities types for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Required. The collection of intents to delete. Only intent `name` must be + * filled in. + */ + // const intents = 1234 + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callBatchDeleteIntents() { + // Construct request + const request = { + parent, + intents, + }; + + // Run request + const [operation] = await dialogflowClient.batchDeleteIntents(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchDeleteIntents(); + // [END dialogflow_v2beta1_generated_Intents_BatchDeleteIntents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.batch_update_intents.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.batch_update_intents.js new file mode 100644 index 00000000000..e2b9ec8b262 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.batch_update_intents.js @@ -0,0 +1,91 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Intents_BatchUpdateIntents_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the agent to update or create intents in. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * 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://". + */ + // const intentBatchUri = 'abc123' + /** + * The collection of intents to update or create. + */ + // const intentBatchInline = {} + /** + * 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). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = {} + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callBatchUpdateIntents() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.batchUpdateIntents(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchUpdateIntents(); + // [END dialogflow_v2beta1_generated_Intents_BatchUpdateIntents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.create_intent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.create_intent.js new file mode 100644 index 00000000000..1bdb28a223c --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.create_intent.js @@ -0,0 +1,81 @@ +// Copyright 2022 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'; + +function main(parent, intent) { + // [START dialogflow_v2beta1_generated_Intents_CreateIntent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to create a intent for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Required. The intent to create. + */ + // const 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). + */ + // const languageCode = 'abc123' + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = {} + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callCreateIntent() { + // Construct request + const request = { + parent, + intent, + }; + + // Run request + const response = await dialogflowClient.createIntent(request); + console.log(response); + } + + callCreateIntent(); + // [END dialogflow_v2beta1_generated_Intents_CreateIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.delete_intent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.delete_intent.js new file mode 100644 index 00000000000..64b530cd709 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.delete_intent.js @@ -0,0 +1,65 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Intents_DeleteIntent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callDeleteIntent() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteIntent(request); + console.log(response); + } + + callDeleteIntent(); + // [END dialogflow_v2beta1_generated_Intents_DeleteIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.get_intent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.get_intent.js new file mode 100644 index 00000000000..3f00eb8f302 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.get_intent.js @@ -0,0 +1,76 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Intents_GetIntent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the intent. + * Supported formats: + * - `projects//agent/intents/` + * - `projects//locations//agent/intents/` + */ + // const name = 'abc123' + /** + * 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). + */ + // const languageCode = 'abc123' + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = {} + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callGetIntent() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getIntent(request); + console.log(response); + } + + callGetIntent(); + // [END dialogflow_v2beta1_generated_Intents_GetIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.list_intents.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.list_intents.js new file mode 100644 index 00000000000..529499a739f --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.list_intents.js @@ -0,0 +1,92 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Intents_ListIntents_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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. + */ + // const parent = 'abc123' + /** + * 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). + */ + // const languageCode = 'abc123' + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = {} + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callListIntents() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listIntentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListIntents(); + // [END dialogflow_v2beta1_generated_Intents_ListIntents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.update_intent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.update_intent.js new file mode 100644 index 00000000000..ee7c7bc9005 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.update_intent.js @@ -0,0 +1,77 @@ +// Copyright 2022 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'; + +function main(intent) { + // [START dialogflow_v2beta1_generated_Intents_UpdateIntent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The intent to update. + */ + // const 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). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = {} + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callUpdateIntent() { + // Construct request + const request = { + intent, + }; + + // Run request + const response = await dialogflowClient.updateIntent(request); + console.log(response); + } + + callUpdateIntent(); + // [END dialogflow_v2beta1_generated_Intents_UpdateIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.create_knowledge_base.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.create_knowledge_base.js new file mode 100644 index 00000000000..e94541196c3 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.create_knowledge_base.js @@ -0,0 +1,67 @@ +// Copyright 2022 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'; + +function main(parent, knowledgeBase) { + // [START dialogflow_v2beta1_generated_KnowledgeBases_CreateKnowledgeBase_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to create a knowledge base for. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Required. The knowledge base to create. + */ + // const knowledgeBase = {} + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function callCreateKnowledgeBase() { + // Construct request + const request = { + parent, + knowledgeBase, + }; + + // Run request + const response = await dialogflowClient.createKnowledgeBase(request); + console.log(response); + } + + callCreateKnowledgeBase(); + // [END dialogflow_v2beta1_generated_KnowledgeBases_CreateKnowledgeBase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.delete_knowledge_base.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.delete_knowledge_base.js new file mode 100644 index 00000000000..c04b4806ab0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.delete_knowledge_base.js @@ -0,0 +1,68 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2beta1_generated_KnowledgeBases_DeleteKnowledgeBase_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the knowledge base to delete. + * Format: `projects//locations//knowledgeBases/`. + */ + // const name = 'abc123' + /** + * Optional. Force deletes the knowledge base. When set to true, any documents + * in the knowledge base are also deleted. + */ + // const force = true + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function callDeleteKnowledgeBase() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteKnowledgeBase(request); + console.log(response); + } + + callDeleteKnowledgeBase(); + // [END dialogflow_v2beta1_generated_KnowledgeBases_DeleteKnowledgeBase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.get_knowledge_base.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.get_knowledge_base.js new file mode 100644 index 00000000000..e87bfd0db99 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.get_knowledge_base.js @@ -0,0 +1,63 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2beta1_generated_KnowledgeBases_GetKnowledgeBase_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the knowledge base to retrieve. + * Format `projects//locations//knowledgeBases/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function callGetKnowledgeBase() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getKnowledgeBase(request); + console.log(response); + } + + callGetKnowledgeBase(); + // [END dialogflow_v2beta1_generated_KnowledgeBases_GetKnowledgeBase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.list_knowledge_bases.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.list_knowledge_bases.js new file mode 100644 index 00000000000..714cd8fa804 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.list_knowledge_bases.js @@ -0,0 +1,95 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_KnowledgeBases_ListKnowledgeBases_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to list of knowledge bases for. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return in a single page. By + * default 10 and at most 100. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + /** + * 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). + */ + // const filter = 'abc123' + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function callListKnowledgeBases() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listKnowledgeBasesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListKnowledgeBases(); + // [END dialogflow_v2beta1_generated_KnowledgeBases_ListKnowledgeBases_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.update_knowledge_base.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.update_knowledge_base.js new file mode 100644 index 00000000000..6d7dad33ee9 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.update_knowledge_base.js @@ -0,0 +1,67 @@ +// Copyright 2022 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'; + +function main(knowledgeBase) { + // [START dialogflow_v2beta1_generated_KnowledgeBases_UpdateKnowledgeBase_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The knowledge base to update. + */ + // const knowledgeBase = {} + /** + * Optional. Not specified means `update all`. + * Currently, only `display_name` can be updated, an InvalidArgument will be + * returned for attempting to update other fields. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function callUpdateKnowledgeBase() { + // Construct request + const request = { + knowledgeBase, + }; + + // Run request + const response = await dialogflowClient.updateKnowledgeBase(request); + console.log(response); + } + + callUpdateKnowledgeBase(); + // [END dialogflow_v2beta1_generated_KnowledgeBases_UpdateKnowledgeBase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.analyze_content.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.analyze_content.js new file mode 100644 index 00000000000..f5dac9c24e8 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.analyze_content.js @@ -0,0 +1,135 @@ +// Copyright 2022 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'; + +function main(participant) { + // [START dialogflow_v2beta1_generated_Participants_AnalyzeContent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant this text comes from. + * Format: `projects//locations//conversations//participants/`. + */ + // const participant = 'abc123' + /** + * The natural language text to be processed. + */ + // const textInput = {} + /** + * The natural language speech audio to be processed. + */ + // const audioInput = {} + /** + * An input event to send to Dialogflow. + */ + // const eventInput = {} + /** + * 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. + */ + // const replyAudioConfig = {} + /** + * Parameters for a Dialogflow virtual-agent query. + */ + // const queryParams = {} + /** + * Parameters for a human assist query. + */ + // const assistQueryParams = {} + /** + * Additional parameters to be put into Dialogflow CX session parameters. To + * remove a parameter from the session, clients should explicitly set the + * parameter value to null. + * Note: this field should only be used if you are connecting to a Dialogflow + * CX agent. + */ + // const cxParameters = {} + /** + * The unique identifier of the CX page to override the `current_page` in the + * session. + * Format: `projects//locations//agents//flows//pages/`. + * If `cx_current_page` is specified, the previous state of the session will + * be ignored by Dialogflow CX, including the previous + * page QueryResult.current_page and the previous session + * parameters QueryResult.parameters. In most cases, `cx_current_page` and + * `cx_parameters` should be configured together to direct a session to a + * specific state. + * Note: this field should only be used if you are connecting to a Dialogflow + * CX agent. + */ + // const cxCurrentPage = 'abc123' + /** + * 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. + */ + // const messageSendTime = {} + /** + * 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. + */ + // const requestId = 'abc123' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callAnalyzeContent() { + // Construct request + const request = { + participant, + }; + + // Run request + const response = await dialogflowClient.analyzeContent(request); + console.log(response); + } + + callAnalyzeContent(); + // [END dialogflow_v2beta1_generated_Participants_AnalyzeContent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.compile_suggestion.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.compile_suggestion.js new file mode 100644 index 00000000000..5001938dfad --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.compile_suggestion.js @@ -0,0 +1,75 @@ +// Copyright 2022 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'; + +function main() { + // [START dialogflow_v2beta1_generated_Participants_CompileSuggestion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + */ + // const parent = 'abc123' + /** + * 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/`. + */ + // const latestMessage = 'abc123' + /** + * 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. + */ + // const contextSize = 1234 + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callCompileSuggestion() { + // Construct request + const request = { + }; + + // Run request + const response = await dialogflowClient.compileSuggestion(request); + console.log(response); + } + + callCompileSuggestion(); + // [END dialogflow_v2beta1_generated_Participants_CompileSuggestion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.create_participant.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.create_participant.js new file mode 100644 index 00000000000..59d6e263e47 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.create_participant.js @@ -0,0 +1,68 @@ +// Copyright 2022 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'; + +function main(parent, participant) { + // [START dialogflow_v2beta1_generated_Participants_CreateParticipant_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource identifier of the conversation adding the participant. + * Format: `projects//locations//conversations/`. + */ + // const parent = 'abc123' + /** + * Required. The participant to create. + */ + // const participant = {} + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callCreateParticipant() { + // Construct request + const request = { + parent, + participant, + }; + + // Run request + const response = await dialogflowClient.createParticipant(request); + console.log(response); + } + + callCreateParticipant(); + // [END dialogflow_v2beta1_generated_Participants_CreateParticipant_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.get_participant.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.get_participant.js new file mode 100644 index 00000000000..1ed6d03766f --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.get_participant.js @@ -0,0 +1,63 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Participants_GetParticipant_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant. Format: + * `projects//locations//conversations//participants/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callGetParticipant() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getParticipant(request); + console.log(response); + } + + callGetParticipant(); + // [END dialogflow_v2beta1_generated_Participants_GetParticipant_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.list_participants.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.list_participants.js new file mode 100644 index 00000000000..f7daa2cb3ef --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.list_participants.js @@ -0,0 +1,74 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Participants_ListParticipants_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The conversation to list all participants from. + * Format: `projects//locations//conversations/`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callListParticipants() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listParticipantsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListParticipants(); + // [END dialogflow_v2beta1_generated_Participants_ListParticipants_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.list_suggestions.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.list_suggestions.js new file mode 100644 index 00000000000..01be69c5f23 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.list_suggestions.js @@ -0,0 +1,83 @@ +// Copyright 2022 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'; + +function main() { + // [START dialogflow_v2beta1_generated_Participants_ListSuggestions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant to fetch suggestions for. + * Format: `projects//locations//conversations//participants/`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. The + * default value is 100; the maximum value is 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + /** + * 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). + */ + // const filter = 'abc123' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callListSuggestions() { + // Construct request + const request = { + }; + + // Run request + const iterable = await dialogflowClient.listSuggestionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSuggestions(); + // [END dialogflow_v2beta1_generated_Participants_ListSuggestions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.streaming_analyze_content.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.streaming_analyze_content.js new file mode 100644 index 00000000000..885759143f3 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.streaming_analyze_content.js @@ -0,0 +1,140 @@ +// Copyright 2022 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'; + +function main(participant) { + // [START dialogflow_v2beta1_generated_Participants_StreamingAnalyzeContent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant this text comes from. + * Format: `projects//locations//conversations//participants/`. + */ + // const participant = 'abc123' + /** + * Instructs the speech recognizer how to process the speech audio. + */ + // const audioConfig = {} + /** + * The natural language text to be processed. + */ + // const textConfig = {} + /** + * 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 + * StreamingAnalyzeContent. If this configuration is not supplied, speech + * synthesis is disabled. + */ + // const replyAudioConfig = {} + /** + * The input audio content to be recognized. Must be sent if `audio_config` + * is set in the first message. The complete audio over all streaming + * messages must not exceed 1 minute. + */ + // const inputAudio = 'Buffer.from('string')' + /** + * The UTF-8 encoded natural language text to be processed. Must be sent if + * `text_config` is set in the first message. Text length must not exceed + * 256 bytes for virtual agent interactions. The `input_text` field can be + * only sent once. + */ + // const inputText = 'abc123' + /** + * The DTMF digits used to invoke intent and fill in parameter value. + * This input is ignored if the previous response indicated that DTMF input + * is not accepted. + */ + // const inputDtmf = {} + /** + * Parameters for a Dialogflow virtual-agent query. + */ + // const queryParams = {} + /** + * Parameters for a human assist query. + */ + // const assistQueryParams = {} + /** + * Additional parameters to be put into Dialogflow CX session parameters. To + * remove a parameter from the session, clients should explicitly set the + * parameter value to null. + * Note: this field should only be used if you are connecting to a Dialogflow + * CX agent. + */ + // const cxParameters = {} + /** + * The unique identifier of the CX page to override the `current_page` in the + * session. + * Format: `projects//locations//agents//flows//pages/`. + * If `cx_current_page` is specified, the previous state of the session will + * be ignored by Dialogflow CX, including the previous + * page QueryResult.current_page and the previous session + * parameters QueryResult.parameters. In most cases, `cx_current_page` and + * `cx_parameters` should be configured together to direct a session to a + * specific state. + * Note: this field should only be used if you are connecting to a Dialogflow + * CX agent. + */ + // const cxCurrentPage = 'abc123' + /** + * Enable partial virtual agent responses. If this flag is not enabled, + * response stream still contains only one final response even if some + * `Fulfillment`s in Dialogflow virtual agent have been configured to return + * partial responses. + */ + // const enablePartialAutomatedAgentReply = true + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callStreamingAnalyzeContent() { + // Construct request + const request = { + participant, + }; + + // Run request + const stream = await dialogflowClient.streamingAnalyzeContent(); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + stream.write(request); + stream.end(); + } + + callStreamingAnalyzeContent(); + // [END dialogflow_v2beta1_generated_Participants_StreamingAnalyzeContent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.suggest_articles.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.suggest_articles.js new file mode 100644 index 00000000000..038326b97be --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.suggest_articles.js @@ -0,0 +1,80 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Participants_SuggestArticles_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + */ + // const parent = 'abc123' + /** + * 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/`. + */ + // const latestMessage = 'abc123' + /** + * 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. + */ + // const contextSize = 1234 + /** + * Optional. Parameters for a human assist query. + */ + // const assistQueryParams = {} + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callSuggestArticles() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.suggestArticles(request); + console.log(response); + } + + callSuggestArticles(); + // [END dialogflow_v2beta1_generated_Participants_SuggestArticles_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.suggest_faq_answers.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.suggest_faq_answers.js new file mode 100644 index 00000000000..cebe5ce478a --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.suggest_faq_answers.js @@ -0,0 +1,80 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Participants_SuggestFaqAnswers_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + */ + // const parent = 'abc123' + /** + * 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/`. + */ + // const latestMessage = 'abc123' + /** + * 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. + */ + // const contextSize = 1234 + /** + * Optional. Parameters for a human assist query. + */ + // const assistQueryParams = {} + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callSuggestFaqAnswers() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.suggestFaqAnswers(request); + console.log(response); + } + + callSuggestFaqAnswers(); + // [END dialogflow_v2beta1_generated_Participants_SuggestFaqAnswers_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.suggest_smart_replies.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.suggest_smart_replies.js new file mode 100644 index 00000000000..15a27996149 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.suggest_smart_replies.js @@ -0,0 +1,82 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Participants_SuggestSmartReplies_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + */ + // const parent = 'abc123' + /** + * 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. + */ + // const currentTextInput = {} + /** + * 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/`. + */ + // const latestMessage = 'abc123' + /** + * 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. + */ + // const contextSize = 1234 + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callSuggestSmartReplies() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.suggestSmartReplies(request); + console.log(response); + } + + callSuggestSmartReplies(); + // [END dialogflow_v2beta1_generated_Participants_SuggestSmartReplies_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.update_participant.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.update_participant.js new file mode 100644 index 00000000000..214454f94f8 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.update_participant.js @@ -0,0 +1,66 @@ +// Copyright 2022 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'; + +function main(participant, updateMask) { + // [START dialogflow_v2beta1_generated_Participants_UpdateParticipant_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The participant to update. + */ + // const participant = {} + /** + * Required. The mask to specify which fields to update. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callUpdateParticipant() { + // Construct request + const request = { + participant, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateParticipant(request); + console.log(response); + } + + callUpdateParticipant(); + // [END dialogflow_v2beta1_generated_Participants_UpdateParticipant_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.create_session_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.create_session_entity_type.js new file mode 100644 index 00000000000..4ed022ae6d8 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.create_session_entity_type.js @@ -0,0 +1,78 @@ +// Copyright 2022 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'; + +function main(parent, sessionEntityType) { + // [START dialogflow_v2beta1_generated_SessionEntityTypes_CreateSessionEntityType_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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. + */ + // const parent = 'abc123' + /** + * Required. The session entity type to create. + */ + // const sessionEntityType = {} + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function callCreateSessionEntityType() { + // Construct request + const request = { + parent, + sessionEntityType, + }; + + // Run request + const response = await dialogflowClient.createSessionEntityType(request); + console.log(response); + } + + callCreateSessionEntityType(); + // [END dialogflow_v2beta1_generated_SessionEntityTypes_CreateSessionEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.delete_session_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.delete_session_entity_type.js new file mode 100644 index 00000000000..f99c287db0b --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.delete_session_entity_type.js @@ -0,0 +1,74 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2beta1_generated_SessionEntityTypes_DeleteSessionEntityType_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function callDeleteSessionEntityType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteSessionEntityType(request); + console.log(response); + } + + callDeleteSessionEntityType(); + // [END dialogflow_v2beta1_generated_SessionEntityTypes_DeleteSessionEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.get_session_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.get_session_entity_type.js new file mode 100644 index 00000000000..a3aafbd9d94 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.get_session_entity_type.js @@ -0,0 +1,73 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2beta1_generated_SessionEntityTypes_GetSessionEntityType_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function callGetSessionEntityType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getSessionEntityType(request); + console.log(response); + } + + callGetSessionEntityType(); + // [END dialogflow_v2beta1_generated_SessionEntityTypes_GetSessionEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.list_session_entity_types.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.list_session_entity_types.js new file mode 100644 index 00000000000..0a6afad6ea7 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.list_session_entity_types.js @@ -0,0 +1,84 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_SessionEntityTypes_ListSessionEntityTypes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function callListSessionEntityTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listSessionEntityTypesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSessionEntityTypes(); + // [END dialogflow_v2beta1_generated_SessionEntityTypes_ListSessionEntityTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.update_session_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.update_session_entity_type.js new file mode 100644 index 00000000000..04cb5585741 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.update_session_entity_type.js @@ -0,0 +1,65 @@ +// Copyright 2022 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'; + +function main(sessionEntityType) { + // [START dialogflow_v2beta1_generated_SessionEntityTypes_UpdateSessionEntityType_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The session entity type to update. + */ + // const sessionEntityType = {} + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function callUpdateSessionEntityType() { + // Construct request + const request = { + sessionEntityType, + }; + + // Run request + const response = await dialogflowClient.updateSessionEntityType(request); + console.log(response); + } + + callUpdateSessionEntityType(); + // [END dialogflow_v2beta1_generated_SessionEntityTypes_UpdateSessionEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/sessions.detect_intent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/sessions.detect_intent.js new file mode 100644 index 00000000000..9069bdd82f5 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/sessions.detect_intent.js @@ -0,0 +1,114 @@ +// Copyright 2022 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'; + +function main(session, queryInput) { + // [START dialogflow_v2beta1_generated_Sessions_DetectIntent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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). + */ + // const session = 'abc123' + /** + * The parameters of this query. + */ + // const queryParams = {} + /** + * 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. + */ + // const queryInput = {} + /** + * 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. + */ + // const outputAudioConfig = {} + /** + * 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. + */ + // const outputAudioConfigMask = {} + /** + * 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. + */ + // const inputAudio = 'Buffer.from('string')' + + // Imports the Dialogflow library + const {SessionsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new SessionsClient(); + + async function callDetectIntent() { + // Construct request + const request = { + session, + queryInput, + }; + + // Run request + const response = await dialogflowClient.detectIntent(request); + console.log(response); + } + + callDetectIntent(); + // [END dialogflow_v2beta1_generated_Sessions_DetectIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/sessions.streaming_detect_intent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/sessions.streaming_detect_intent.js new file mode 100644 index 00000000000..52d75538ff7 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/sessions.streaming_detect_intent.js @@ -0,0 +1,130 @@ +// Copyright 2022 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'; + +function main(session, queryInput) { + // [START dialogflow_v2beta1_generated_Sessions_StreamingDetectIntent_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The 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). + */ + // const session = 'abc123' + /** + * The parameters of this query. + */ + // const queryParams = {} + /** + * 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. + */ + // const queryInput = {} + /** + * 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. + */ + // const singleUtterance = 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. + */ + // const outputAudioConfig = {} + /** + * 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. + */ + // const outputAudioConfigMask = {} + /** + * 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. + */ + // const inputAudio = 'Buffer.from('string')' + + // Imports the Dialogflow library + const {SessionsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new SessionsClient(); + + async function callStreamingDetectIntent() { + // Construct request + const request = { + session, + queryInput, + }; + + // Run request + const stream = await dialogflowClient.streamingDetectIntent(); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + stream.write(request); + stream.end(); + } + + callStreamingDetectIntent(); + // [END dialogflow_v2beta1_generated_Sessions_StreamingDetectIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/snippet_metadata.google.cloud.dialogflow.v2beta1.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/snippet_metadata.google.cloud.dialogflow.v2beta1.json new file mode 100644 index 00000000000..f989adf3f04 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/snippet_metadata.google.cloud.dialogflow.v2beta1.json @@ -0,0 +1,4327 @@ +{ + "clientLibrary": { + "name": "nodejs-dialogflow", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.dialogflow.v2beta1", + "version": "v2beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "dialogflow_v2beta1_generated_Agents_GetAgent_async", + "title": "dialogflow getAgent Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified agent.", + "canonical": true, + "file": "agents.get_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.GetAgent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Agent", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" + }, + "method": { + "shortName": "GetAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.GetAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2beta1.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Agents_SetAgent_async", + "title": "dialogflow setAgent Sample", + "origin": "API_DEFINITION", + "description": " 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).", + "canonical": true, + "file": "agents.set_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.SetAgent", + "async": true, + "parameters": [ + { + "name": "agent", + "type": ".google.cloud.dialogflow.v2beta1.Agent" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Agent", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" + }, + "method": { + "shortName": "SetAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.SetAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2beta1.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Agents_DeleteAgent_async", + "title": "dialogflow deleteAgent Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified agent.", + "canonical": true, + "file": "agents.delete_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.DeleteAgent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" + }, + "method": { + "shortName": "DeleteAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.DeleteAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2beta1.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Agents_SearchAgents_async", + "title": "dialogflow searchAgents Sample", + "origin": "API_DEFINITION", + "description": " 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).", + "canonical": true, + "file": "agents.search_agents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SearchAgents", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.SearchAgents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.SearchAgentsResponse", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" + }, + "method": { + "shortName": "SearchAgents", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.SearchAgents", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2beta1.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Agents_TrainAgent_async", + "title": "dialogflow trainAgent Sample", + "origin": "API_DEFINITION", + "description": " Trains the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "agents.train_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TrainAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.TrainAgent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" + }, + "method": { + "shortName": "TrainAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.TrainAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2beta1.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Agents_ExportAgent_async", + "title": "dialogflow exportAgent Sample", + "origin": "API_DEFINITION", + "description": " Exports the specified agent to a ZIP file. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [ExportAgentResponse][google.cloud.dialogflow.v2beta1.ExportAgentResponse]", + "canonical": true, + "file": "agents.export_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ExportAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.ExportAgent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "agent_uri", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" + }, + "method": { + "shortName": "ExportAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.ExportAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2beta1.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Agents_ImportAgent_async", + "title": "dialogflow importAgent Sample", + "origin": "API_DEFINITION", + "description": " 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. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) The operation only tracks when importing is complete, 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).", + "canonical": true, + "file": "agents.import_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.ImportAgent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "agent_uri", + "type": "TYPE_STRING" + }, + { + "name": "agent_content", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" + }, + "method": { + "shortName": "ImportAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.ImportAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2beta1.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Agents_RestoreAgent_async", + "title": "dialogflow restoreAgent Sample", + "origin": "API_DEFINITION", + "description": " 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. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) The operation only tracks when restoring is complete, 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).", + "canonical": true, + "file": "agents.restore_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RestoreAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.RestoreAgent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "agent_uri", + "type": "TYPE_STRING" + }, + { + "name": "agent_content", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" + }, + "method": { + "shortName": "RestoreAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.RestoreAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2beta1.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Agents_GetValidationResult_async", + "title": "dialogflow getValidationResult Sample", + "origin": "API_DEFINITION", + "description": " Gets agent validation result. Agent validation is performed during training time and is updated automatically when training is completed.", + "canonical": true, + "file": "agents.get_validation_result.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetValidationResult", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.GetValidationResult", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ValidationResult", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" + }, + "method": { + "shortName": "GetValidationResult", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.GetValidationResult", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2beta1.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_AnswerRecords_GetAnswerRecord_async", + "title": "dialogflow getAnswerRecord Sample", + "origin": "API_DEFINITION", + "description": " Deprecated. Retrieves a specific answer record.", + "canonical": true, + "file": "answer_records.get_answer_record.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAnswerRecord", + "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords.GetAnswerRecord", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.AnswerRecord", + "client": { + "shortName": "AnswerRecordsClient", + "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecordsClient" + }, + "method": { + "shortName": "GetAnswerRecord", + "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords.GetAnswerRecord", + "service": { + "shortName": "AnswerRecords", + "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_AnswerRecords_ListAnswerRecords_async", + "title": "dialogflow listAnswerRecords Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all answer records in the specified project in reverse chronological order.", + "canonical": true, + "file": "answer_records.list_answer_records.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAnswerRecords", + "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords.ListAnswerRecords", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse", + "client": { + "shortName": "AnswerRecordsClient", + "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecordsClient" + }, + "method": { + "shortName": "ListAnswerRecords", + "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords.ListAnswerRecords", + "service": { + "shortName": "AnswerRecords", + "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_AnswerRecords_UpdateAnswerRecord_async", + "title": "dialogflow updateAnswerRecord Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified answer record.", + "canonical": true, + "file": "answer_records.update_answer_record.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateAnswerRecord", + "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords.UpdateAnswerRecord", + "async": true, + "parameters": [ + { + "name": "answer_record", + "type": ".google.cloud.dialogflow.v2beta1.AnswerRecord" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.AnswerRecord", + "client": { + "shortName": "AnswerRecordsClient", + "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecordsClient" + }, + "method": { + "shortName": "UpdateAnswerRecord", + "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords.UpdateAnswerRecord", + "service": { + "shortName": "AnswerRecords", + "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Contexts_ListContexts_async", + "title": "dialogflow listContexts Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all contexts in the specified session.", + "canonical": true, + "file": "contexts.list_contexts.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListContexts", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts.ListContexts", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListContextsResponse", + "client": { + "shortName": "ContextsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ContextsClient" + }, + "method": { + "shortName": "ListContexts", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts.ListContexts", + "service": { + "shortName": "Contexts", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Contexts_GetContext_async", + "title": "dialogflow getContext Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified context.", + "canonical": true, + "file": "contexts.get_context.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetContext", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts.GetContext", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Context", + "client": { + "shortName": "ContextsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ContextsClient" + }, + "method": { + "shortName": "GetContext", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts.GetContext", + "service": { + "shortName": "Contexts", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Contexts_CreateContext_async", + "title": "dialogflow createContext Sample", + "origin": "API_DEFINITION", + "description": " Creates a context. If the specified context already exists, overrides the context.", + "canonical": true, + "file": "contexts.create_context.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateContext", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts.CreateContext", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "context", + "type": ".google.cloud.dialogflow.v2beta1.Context" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Context", + "client": { + "shortName": "ContextsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ContextsClient" + }, + "method": { + "shortName": "CreateContext", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts.CreateContext", + "service": { + "shortName": "Contexts", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Contexts_UpdateContext_async", + "title": "dialogflow updateContext Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified context.", + "canonical": true, + "file": "contexts.update_context.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateContext", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts.UpdateContext", + "async": true, + "parameters": [ + { + "name": "context", + "type": ".google.cloud.dialogflow.v2beta1.Context" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Context", + "client": { + "shortName": "ContextsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ContextsClient" + }, + "method": { + "shortName": "UpdateContext", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts.UpdateContext", + "service": { + "shortName": "Contexts", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Contexts_DeleteContext_async", + "title": "dialogflow deleteContext Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified context.", + "canonical": true, + "file": "contexts.delete_context.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteContext", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts.DeleteContext", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ContextsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ContextsClient" + }, + "method": { + "shortName": "DeleteContext", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts.DeleteContext", + "service": { + "shortName": "Contexts", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Contexts_DeleteAllContexts_async", + "title": "dialogflow deleteAllContexts Sample", + "origin": "API_DEFINITION", + "description": " Deletes all active contexts in the specified session.", + "canonical": true, + "file": "contexts.delete_all_contexts.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteAllContexts", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts.DeleteAllContexts", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ContextsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ContextsClient" + }, + "method": { + "shortName": "DeleteAllContexts", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts.DeleteAllContexts", + "service": { + "shortName": "Contexts", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_ConversationProfiles_ListConversationProfiles_async", + "title": "dialogflow listConversationProfiles Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all conversation profiles in the specified project.", + "canonical": true, + "file": "conversation_profiles.list_conversation_profiles.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListConversationProfiles", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.ListConversationProfiles", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfilesClient" + }, + "method": { + "shortName": "ListConversationProfiles", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.ListConversationProfiles", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_ConversationProfiles_GetConversationProfile_async", + "title": "dialogflow getConversationProfile Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified conversation profile.", + "canonical": true, + "file": "conversation_profiles.get_conversation_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetConversationProfile", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfile", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ConversationProfile", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfilesClient" + }, + "method": { + "shortName": "GetConversationProfile", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfile", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_ConversationProfiles_CreateConversationProfile_async", + "title": "dialogflow createConversationProfile Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "conversation_profiles.create_conversation_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateConversationProfile", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.CreateConversationProfile", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "conversation_profile", + "type": ".google.cloud.dialogflow.v2beta1.ConversationProfile" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ConversationProfile", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfilesClient" + }, + "method": { + "shortName": "CreateConversationProfile", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.CreateConversationProfile", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_ConversationProfiles_UpdateConversationProfile_async", + "title": "dialogflow updateConversationProfile Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "conversation_profiles.update_conversation_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateConversationProfile", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.UpdateConversationProfile", + "async": true, + "parameters": [ + { + "name": "conversation_profile", + "type": ".google.cloud.dialogflow.v2beta1.ConversationProfile" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ConversationProfile", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfilesClient" + }, + "method": { + "shortName": "UpdateConversationProfile", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.UpdateConversationProfile", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_ConversationProfiles_DeleteConversationProfile_async", + "title": "dialogflow deleteConversationProfile Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified conversation profile.", + "canonical": true, + "file": "conversation_profiles.delete_conversation_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteConversationProfile", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.DeleteConversationProfile", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfilesClient" + }, + "method": { + "shortName": "DeleteConversationProfile", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.DeleteConversationProfile", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_ConversationProfiles_SetSuggestionFeatureConfig_async", + "title": "dialogflow setSuggestionFeatureConfig Sample", + "origin": "API_DEFINITION", + "description": " Adds or updates a suggestion feature in a conversation profile. If the conversation profile contains the type of suggestion feature for the participant role, it will update it. Otherwise it will insert the suggestion feature. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [SetSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata] - `response`: [ConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfile] If a long running operation to add or update suggestion feature config for the same conversation profile, participant role and suggestion feature type exists, please cancel the existing long running operation before sending such request, otherwise the request will be rejected.", + "canonical": true, + "file": "conversation_profiles.set_suggestion_feature_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetSuggestionFeatureConfig", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.SetSuggestionFeatureConfig", + "async": true, + "parameters": [ + { + "name": "conversation_profile", + "type": "TYPE_STRING" + }, + { + "name": "participant_role", + "type": ".google.cloud.dialogflow.v2beta1.Participant.Role" + }, + { + "name": "suggestion_feature_config", + "type": ".google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfilesClient" + }, + "method": { + "shortName": "SetSuggestionFeatureConfig", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.SetSuggestionFeatureConfig", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async", + "title": "dialogflow clearSuggestionFeatureConfig Sample", + "origin": "API_DEFINITION", + "description": " Clears a suggestion feature from a conversation profile for the given participant role. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [ClearSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata] - `response`: [ConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfile]", + "canonical": true, + "file": "conversation_profiles.clear_suggestion_feature_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ClearSuggestionFeatureConfig", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.ClearSuggestionFeatureConfig", + "async": true, + "parameters": [ + { + "name": "conversation_profile", + "type": "TYPE_STRING" + }, + { + "name": "participant_role", + "type": ".google.cloud.dialogflow.v2beta1.Participant.Role" + }, + { + "name": "suggestion_feature_type", + "type": ".google.cloud.dialogflow.v2beta1.SuggestionFeature.Type" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfilesClient" + }, + "method": { + "shortName": "ClearSuggestionFeatureConfig", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.ClearSuggestionFeatureConfig", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Conversations_CreateConversation_async", + "title": "dialogflow createConversation Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "conversations.create_conversation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateConversation", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.CreateConversation", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "conversation", + "type": ".google.cloud.dialogflow.v2beta1.Conversation" + }, + { + "name": "conversation_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Conversation", + "client": { + "shortName": "ConversationsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationsClient" + }, + "method": { + "shortName": "CreateConversation", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.CreateConversation", + "service": { + "shortName": "Conversations", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Conversations_ListConversations_async", + "title": "dialogflow listConversations Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all conversations in the specified project.", + "canonical": true, + "file": "conversations.list_conversations.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListConversations", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.ListConversations", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListConversationsResponse", + "client": { + "shortName": "ConversationsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationsClient" + }, + "method": { + "shortName": "ListConversations", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.ListConversations", + "service": { + "shortName": "Conversations", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Conversations_GetConversation_async", + "title": "dialogflow getConversation Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specific conversation.", + "canonical": true, + "file": "conversations.get_conversation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetConversation", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.GetConversation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Conversation", + "client": { + "shortName": "ConversationsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationsClient" + }, + "method": { + "shortName": "GetConversation", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.GetConversation", + "service": { + "shortName": "Conversations", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Conversations_CompleteConversation_async", + "title": "dialogflow completeConversation Sample", + "origin": "API_DEFINITION", + "description": " Completes the specified conversation. Finished conversations are purged from the database after 30 days.", + "canonical": true, + "file": "conversations.complete_conversation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CompleteConversation", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.CompleteConversation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Conversation", + "client": { + "shortName": "ConversationsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationsClient" + }, + "method": { + "shortName": "CompleteConversation", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.CompleteConversation", + "service": { + "shortName": "Conversations", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Conversations_BatchCreateMessages_async", + "title": "dialogflow batchCreateMessages Sample", + "origin": "API_DEFINITION", + "description": " Batch ingests messages to conversation. Customers can use this RPC to ingest historical messages to conversation.", + "canonical": true, + "file": "conversations.batch_create_messages.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchCreateMessages", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.BatchCreateMessages", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "requests", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse", + "client": { + "shortName": "ConversationsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationsClient" + }, + "method": { + "shortName": "BatchCreateMessages", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.BatchCreateMessages", + "service": { + "shortName": "Conversations", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Conversations_ListMessages_async", + "title": "dialogflow listMessages Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "conversations.list_messages.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListMessages", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.ListMessages", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListMessagesResponse", + "client": { + "shortName": "ConversationsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationsClient" + }, + "method": { + "shortName": "ListMessages", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.ListMessages", + "service": { + "shortName": "Conversations", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Conversations_SuggestConversationSummary_async", + "title": "dialogflow suggestConversationSummary Sample", + "origin": "API_DEFINITION", + "description": " Suggest summary for a conversation based on specific historical messages. The range of the messages to be used for summary can be specified in the request.", + "canonical": true, + "file": "conversations.suggest_conversation_summary.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SuggestConversationSummary", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.SuggestConversationSummary", + "async": true, + "parameters": [ + { + "name": "conversation", + "type": "TYPE_STRING" + }, + { + "name": "latest_message", + "type": "TYPE_STRING" + }, + { + "name": "context_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse", + "client": { + "shortName": "ConversationsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationsClient" + }, + "method": { + "shortName": "SuggestConversationSummary", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.SuggestConversationSummary", + "service": { + "shortName": "Conversations", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Documents_ListDocuments_async", + "title": "dialogflow listDocuments Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all documents of the knowledge base. Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.", + "canonical": true, + "file": "documents.list_documents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListDocuments", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.ListDocuments", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListDocumentsResponse", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.DocumentsClient" + }, + "method": { + "shortName": "ListDocuments", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.ListDocuments", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2beta1.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Documents_GetDocument_async", + "title": "dialogflow getDocument Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified document. Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.", + "canonical": true, + "file": "documents.get_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDocument", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.GetDocument", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Document", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.DocumentsClient" + }, + "method": { + "shortName": "GetDocument", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.GetDocument", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2beta1.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Documents_CreateDocument_async", + "title": "dialogflow createDocument Sample", + "origin": "API_DEFINITION", + "description": " Creates a new document. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] - `response`: [Document][google.cloud.dialogflow.v2beta1.Document] Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.", + "canonical": true, + "file": "documents.create_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateDocument", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.CreateDocument", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "document", + "type": ".google.cloud.dialogflow.v2beta1.Document" + }, + { + "name": "import_gcs_custom_metadata", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.DocumentsClient" + }, + "method": { + "shortName": "CreateDocument", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.CreateDocument", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2beta1.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Documents_ImportDocuments_async", + "title": "dialogflow importDocuments Sample", + "origin": "API_DEFINITION", + "description": " 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. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] - `response`: [ImportDocumentsResponse][google.cloud.dialogflow.v2beta1.ImportDocumentsResponse]", + "canonical": true, + "file": "documents.import_documents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportDocuments", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.ImportDocuments", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "gcs_source", + "type": ".google.cloud.dialogflow.v2beta1.GcsSources" + }, + { + "name": "document_template", + "type": ".google.cloud.dialogflow.v2beta1.ImportDocumentTemplate" + }, + { + "name": "import_gcs_custom_metadata", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.DocumentsClient" + }, + "method": { + "shortName": "ImportDocuments", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.ImportDocuments", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2beta1.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Documents_DeleteDocument_async", + "title": "dialogflow deleteDocument Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified document. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.", + "canonical": true, + "file": "documents.delete_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteDocument", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.DeleteDocument", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.DocumentsClient" + }, + "method": { + "shortName": "DeleteDocument", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.DeleteDocument", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2beta1.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Documents_UpdateDocument_async", + "title": "dialogflow updateDocument Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified document. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] - `response`: [Document][google.cloud.dialogflow.v2beta1.Document] Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.", + "canonical": true, + "file": "documents.update_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateDocument", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.UpdateDocument", + "async": true, + "parameters": [ + { + "name": "document", + "type": ".google.cloud.dialogflow.v2beta1.Document" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.DocumentsClient" + }, + "method": { + "shortName": "UpdateDocument", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.UpdateDocument", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2beta1.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Documents_ReloadDocument_async", + "title": "dialogflow reloadDocument Sample", + "origin": "API_DEFINITION", + "description": " 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. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] - `response`: [Document][google.cloud.dialogflow.v2beta1.Document] Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.", + "canonical": true, + "file": "documents.reload_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReloadDocument", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.ReloadDocument", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "gcs_source", + "type": ".google.cloud.dialogflow.v2beta1.GcsSource" + }, + { + "name": "import_gcs_custom_metadata", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.DocumentsClient" + }, + "method": { + "shortName": "ReloadDocument", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.ReloadDocument", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2beta1.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_EntityTypes_ListEntityTypes_async", + "title": "dialogflow listEntityTypes Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all entity types in the specified agent.", + "canonical": true, + "file": "entity_types.list_entity_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListEntityTypesResponse", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" + }, + "method": { + "shortName": "ListEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_EntityTypes_GetEntityType_async", + "title": "dialogflow getEntityType Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified entity type.", + "canonical": true, + "file": "entity_types.get_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.GetEntityType", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.EntityType", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" + }, + "method": { + "shortName": "GetEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.GetEntityType", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_EntityTypes_CreateEntityType_async", + "title": "dialogflow createEntityType Sample", + "origin": "API_DEFINITION", + "description": " 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).", + "canonical": true, + "file": "entity_types.create_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.CreateEntityType", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "entity_type", + "type": ".google.cloud.dialogflow.v2beta1.EntityType" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.EntityType", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" + }, + "method": { + "shortName": "CreateEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.CreateEntityType", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_EntityTypes_UpdateEntityType_async", + "title": "dialogflow updateEntityType Sample", + "origin": "API_DEFINITION", + "description": " 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).", + "canonical": true, + "file": "entity_types.update_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.UpdateEntityType", + "async": true, + "parameters": [ + { + "name": "entity_type", + "type": ".google.cloud.dialogflow.v2beta1.EntityType" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.EntityType", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" + }, + "method": { + "shortName": "UpdateEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.UpdateEntityType", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_EntityTypes_DeleteEntityType_async", + "title": "dialogflow deleteEntityType Sample", + "origin": "API_DEFINITION", + "description": " 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).", + "canonical": true, + "file": "entity_types.delete_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.DeleteEntityType", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" + }, + "method": { + "shortName": "DeleteEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.DeleteEntityType", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntityTypes_async", + "title": "dialogflow batchUpdateEntityTypes Sample", + "origin": "API_DEFINITION", + "description": " Updates/Creates multiple entity types in the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [BatchUpdateEntityTypesResponse][google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse] Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "entity_types.batch_update_entity_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchUpdateEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "entity_type_batch_uri", + "type": "TYPE_STRING" + }, + { + "name": "entity_type_batch_inline", + "type": ".google.cloud.dialogflow.v2beta1.EntityTypeBatch" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" + }, + "method": { + "shortName": "BatchUpdateEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntityTypes_async", + "title": "dialogflow batchDeleteEntityTypes Sample", + "origin": "API_DEFINITION", + "description": " Deletes entity types in the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "entity_types.batch_delete_entity_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchDeleteEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntityTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "entity_type_names", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" + }, + "method": { + "shortName": "BatchDeleteEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntityTypes", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_EntityTypes_BatchCreateEntities_async", + "title": "dialogflow batchCreateEntities Sample", + "origin": "API_DEFINITION", + "description": " Creates multiple new entities in the specified entity type. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "entity_types.batch_create_entities.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchCreateEntities", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchCreateEntities", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "entities", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" + }, + "method": { + "shortName": "BatchCreateEntities", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchCreateEntities", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntities_async", + "title": "dialogflow batchUpdateEntities Sample", + "origin": "API_DEFINITION", + "description": " 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). This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)", + "canonical": true, + "file": "entity_types.batch_update_entities.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchUpdateEntities", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntities", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "entities", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" + }, + "method": { + "shortName": "BatchUpdateEntities", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntities", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntities_async", + "title": "dialogflow batchDeleteEntities Sample", + "origin": "API_DEFINITION", + "description": " Deletes entities in the specified entity type. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "entity_types.batch_delete_entities.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchDeleteEntities", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntities", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "entity_values", + "type": "TYPE_STRING[]" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" + }, + "method": { + "shortName": "BatchDeleteEntities", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntities", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Environments_ListEnvironments_async", + "title": "dialogflow listEnvironments Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all non-draft environments of the specified agent.", + "canonical": true, + "file": "environments.list_environments.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListEnvironments", + "fullName": "google.cloud.dialogflow.v2beta1.Environments.ListEnvironments", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse", + "client": { + "shortName": "EnvironmentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.EnvironmentsClient" + }, + "method": { + "shortName": "ListEnvironments", + "fullName": "google.cloud.dialogflow.v2beta1.Environments.ListEnvironments", + "service": { + "shortName": "Environments", + "fullName": "google.cloud.dialogflow.v2beta1.Environments" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Environments_GetEnvironment_async", + "title": "dialogflow getEnvironment Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified agent environment.", + "canonical": true, + "file": "environments.get_environment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetEnvironment", + "fullName": "google.cloud.dialogflow.v2beta1.Environments.GetEnvironment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Environment", + "client": { + "shortName": "EnvironmentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.EnvironmentsClient" + }, + "method": { + "shortName": "GetEnvironment", + "fullName": "google.cloud.dialogflow.v2beta1.Environments.GetEnvironment", + "service": { + "shortName": "Environments", + "fullName": "google.cloud.dialogflow.v2beta1.Environments" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Environments_CreateEnvironment_async", + "title": "dialogflow createEnvironment Sample", + "origin": "API_DEFINITION", + "description": " Creates an agent environment.", + "canonical": true, + "file": "environments.create_environment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateEnvironment", + "fullName": "google.cloud.dialogflow.v2beta1.Environments.CreateEnvironment", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "environment", + "type": ".google.cloud.dialogflow.v2beta1.Environment" + }, + { + "name": "environment_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Environment", + "client": { + "shortName": "EnvironmentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.EnvironmentsClient" + }, + "method": { + "shortName": "CreateEnvironment", + "fullName": "google.cloud.dialogflow.v2beta1.Environments.CreateEnvironment", + "service": { + "shortName": "Environments", + "fullName": "google.cloud.dialogflow.v2beta1.Environments" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Environments_UpdateEnvironment_async", + "title": "dialogflow updateEnvironment Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "environments.update_environment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateEnvironment", + "fullName": "google.cloud.dialogflow.v2beta1.Environments.UpdateEnvironment", + "async": true, + "parameters": [ + { + "name": "environment", + "type": ".google.cloud.dialogflow.v2beta1.Environment" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "allow_load_to_draft_and_discard_changes", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Environment", + "client": { + "shortName": "EnvironmentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.EnvironmentsClient" + }, + "method": { + "shortName": "UpdateEnvironment", + "fullName": "google.cloud.dialogflow.v2beta1.Environments.UpdateEnvironment", + "service": { + "shortName": "Environments", + "fullName": "google.cloud.dialogflow.v2beta1.Environments" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Environments_DeleteEnvironment_async", + "title": "dialogflow deleteEnvironment Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified agent environment.", + "canonical": true, + "file": "environments.delete_environment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteEnvironment", + "fullName": "google.cloud.dialogflow.v2beta1.Environments.DeleteEnvironment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "EnvironmentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.EnvironmentsClient" + }, + "method": { + "shortName": "DeleteEnvironment", + "fullName": "google.cloud.dialogflow.v2beta1.Environments.DeleteEnvironment", + "service": { + "shortName": "Environments", + "fullName": "google.cloud.dialogflow.v2beta1.Environments" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Environments_GetEnvironmentHistory_async", + "title": "dialogflow getEnvironmentHistory Sample", + "origin": "API_DEFINITION", + "description": " Gets the history of the specified environment.", + "canonical": true, + "file": "environments.get_environment_history.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetEnvironmentHistory", + "fullName": "google.cloud.dialogflow.v2beta1.Environments.GetEnvironmentHistory", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.EnvironmentHistory", + "client": { + "shortName": "EnvironmentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.EnvironmentsClient" + }, + "method": { + "shortName": "GetEnvironmentHistory", + "fullName": "google.cloud.dialogflow.v2beta1.Environments.GetEnvironmentHistory", + "service": { + "shortName": "Environments", + "fullName": "google.cloud.dialogflow.v2beta1.Environments" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Fulfillments_GetFulfillment_async", + "title": "dialogflow getFulfillment Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the fulfillment.", + "canonical": true, + "file": "fulfillments.get_fulfillment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFulfillment", + "fullName": "google.cloud.dialogflow.v2beta1.Fulfillments.GetFulfillment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Fulfillment", + "client": { + "shortName": "FulfillmentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.FulfillmentsClient" + }, + "method": { + "shortName": "GetFulfillment", + "fullName": "google.cloud.dialogflow.v2beta1.Fulfillments.GetFulfillment", + "service": { + "shortName": "Fulfillments", + "fullName": "google.cloud.dialogflow.v2beta1.Fulfillments" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Fulfillments_UpdateFulfillment_async", + "title": "dialogflow updateFulfillment Sample", + "origin": "API_DEFINITION", + "description": " Updates the fulfillment.", + "canonical": true, + "file": "fulfillments.update_fulfillment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFulfillment", + "fullName": "google.cloud.dialogflow.v2beta1.Fulfillments.UpdateFulfillment", + "async": true, + "parameters": [ + { + "name": "fulfillment", + "type": ".google.cloud.dialogflow.v2beta1.Fulfillment" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Fulfillment", + "client": { + "shortName": "FulfillmentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.FulfillmentsClient" + }, + "method": { + "shortName": "UpdateFulfillment", + "fullName": "google.cloud.dialogflow.v2beta1.Fulfillments.UpdateFulfillment", + "service": { + "shortName": "Fulfillments", + "fullName": "google.cloud.dialogflow.v2beta1.Fulfillments" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Intents_ListIntents_async", + "title": "dialogflow listIntents Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all intents in the specified agent.", + "canonical": true, + "file": "intents.list_intents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListIntents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.ListIntents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "intent_view", + "type": ".google.cloud.dialogflow.v2beta1.IntentView" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListIntentsResponse", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.IntentsClient" + }, + "method": { + "shortName": "ListIntents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.ListIntents", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Intents_GetIntent_async", + "title": "dialogflow getIntent Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified intent.", + "canonical": true, + "file": "intents.get_intent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIntent", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.GetIntent", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "intent_view", + "type": ".google.cloud.dialogflow.v2beta1.IntentView" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Intent", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.IntentsClient" + }, + "method": { + "shortName": "GetIntent", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.GetIntent", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Intents_CreateIntent_async", + "title": "dialogflow createIntent Sample", + "origin": "API_DEFINITION", + "description": " 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).", + "canonical": true, + "file": "intents.create_intent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateIntent", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.CreateIntent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "intent", + "type": ".google.cloud.dialogflow.v2beta1.Intent" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "intent_view", + "type": ".google.cloud.dialogflow.v2beta1.IntentView" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Intent", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.IntentsClient" + }, + "method": { + "shortName": "CreateIntent", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.CreateIntent", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Intents_UpdateIntent_async", + "title": "dialogflow updateIntent Sample", + "origin": "API_DEFINITION", + "description": " 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).", + "canonical": true, + "file": "intents.update_intent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateIntent", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.UpdateIntent", + "async": true, + "parameters": [ + { + "name": "intent", + "type": ".google.cloud.dialogflow.v2beta1.Intent" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "intent_view", + "type": ".google.cloud.dialogflow.v2beta1.IntentView" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Intent", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.IntentsClient" + }, + "method": { + "shortName": "UpdateIntent", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.UpdateIntent", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Intents_DeleteIntent_async", + "title": "dialogflow deleteIntent Sample", + "origin": "API_DEFINITION", + "description": " 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).", + "canonical": true, + "file": "intents.delete_intent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteIntent", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.DeleteIntent", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.IntentsClient" + }, + "method": { + "shortName": "DeleteIntent", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.DeleteIntent", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Intents_BatchUpdateIntents_async", + "title": "dialogflow batchUpdateIntents Sample", + "origin": "API_DEFINITION", + "description": " Updates/Creates multiple intents in the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse] Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "intents.batch_update_intents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchUpdateIntents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "intent_batch_uri", + "type": "TYPE_STRING" + }, + { + "name": "intent_batch_inline", + "type": ".google.cloud.dialogflow.v2beta1.IntentBatch" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "intent_view", + "type": ".google.cloud.dialogflow.v2beta1.IntentView" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.IntentsClient" + }, + "method": { + "shortName": "BatchUpdateIntents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Intents_BatchDeleteIntents_async", + "title": "dialogflow batchDeleteIntents Sample", + "origin": "API_DEFINITION", + "description": " Deletes intents in the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "intents.batch_delete_intents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchDeleteIntents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.BatchDeleteIntents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "intents", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.IntentsClient" + }, + "method": { + "shortName": "BatchDeleteIntents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.BatchDeleteIntents", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_KnowledgeBases_ListKnowledgeBases_async", + "title": "dialogflow listKnowledgeBases Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all knowledge bases of the specified agent. Note: The `projects.agent.knowledgeBases` resource is deprecated; only use `projects.knowledgeBases`.", + "canonical": true, + "file": "knowledge_bases.list_knowledge_bases.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 87, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListKnowledgeBases", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse", + "client": { + "shortName": "KnowledgeBasesClient", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBasesClient" + }, + "method": { + "shortName": "ListKnowledgeBases", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases", + "service": { + "shortName": "KnowledgeBases", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_KnowledgeBases_GetKnowledgeBase_async", + "title": "dialogflow getKnowledgeBase Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified knowledge base. Note: The `projects.agent.knowledgeBases` resource is deprecated; only use `projects.knowledgeBases`.", + "canonical": true, + "file": "knowledge_bases.get_knowledge_base.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.GetKnowledgeBase", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.KnowledgeBase", + "client": { + "shortName": "KnowledgeBasesClient", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBasesClient" + }, + "method": { + "shortName": "GetKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.GetKnowledgeBase", + "service": { + "shortName": "KnowledgeBases", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_KnowledgeBases_CreateKnowledgeBase_async", + "title": "dialogflow createKnowledgeBase Sample", + "origin": "API_DEFINITION", + "description": " Creates a knowledge base. Note: The `projects.agent.knowledgeBases` resource is deprecated; only use `projects.knowledgeBases`.", + "canonical": true, + "file": "knowledge_bases.create_knowledge_base.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.CreateKnowledgeBase", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "knowledge_base", + "type": ".google.cloud.dialogflow.v2beta1.KnowledgeBase" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.KnowledgeBase", + "client": { + "shortName": "KnowledgeBasesClient", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBasesClient" + }, + "method": { + "shortName": "CreateKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.CreateKnowledgeBase", + "service": { + "shortName": "KnowledgeBases", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_KnowledgeBases_DeleteKnowledgeBase_async", + "title": "dialogflow deleteKnowledgeBase Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified knowledge base. Note: The `projects.agent.knowledgeBases` resource is deprecated; only use `projects.knowledgeBases`.", + "canonical": true, + "file": "knowledge_bases.delete_knowledge_base.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.DeleteKnowledgeBase", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "KnowledgeBasesClient", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBasesClient" + }, + "method": { + "shortName": "DeleteKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.DeleteKnowledgeBase", + "service": { + "shortName": "KnowledgeBases", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_KnowledgeBases_UpdateKnowledgeBase_async", + "title": "dialogflow updateKnowledgeBase Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified knowledge base. Note: The `projects.agent.knowledgeBases` resource is deprecated; only use `projects.knowledgeBases`.", + "canonical": true, + "file": "knowledge_bases.update_knowledge_base.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.UpdateKnowledgeBase", + "async": true, + "parameters": [ + { + "name": "knowledge_base", + "type": ".google.cloud.dialogflow.v2beta1.KnowledgeBase" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.KnowledgeBase", + "client": { + "shortName": "KnowledgeBasesClient", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBasesClient" + }, + "method": { + "shortName": "UpdateKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.UpdateKnowledgeBase", + "service": { + "shortName": "KnowledgeBases", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Participants_CreateParticipant_async", + "title": "dialogflow createParticipant Sample", + "origin": "API_DEFINITION", + "description": " Creates a new participant in a conversation.", + "canonical": true, + "file": "participants.create_participant.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateParticipant", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.CreateParticipant", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "participant", + "type": ".google.cloud.dialogflow.v2beta1.Participant" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Participant", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" + }, + "method": { + "shortName": "CreateParticipant", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.CreateParticipant", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Participants_GetParticipant_async", + "title": "dialogflow getParticipant Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a conversation participant.", + "canonical": true, + "file": "participants.get_participant.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetParticipant", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.GetParticipant", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Participant", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" + }, + "method": { + "shortName": "GetParticipant", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.GetParticipant", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Participants_ListParticipants_async", + "title": "dialogflow listParticipants Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all participants in the specified conversation.", + "canonical": true, + "file": "participants.list_participants.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListParticipants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.ListParticipants", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListParticipantsResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" + }, + "method": { + "shortName": "ListParticipants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.ListParticipants", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Participants_UpdateParticipant_async", + "title": "dialogflow updateParticipant Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified participant.", + "canonical": true, + "file": "participants.update_participant.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateParticipant", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.UpdateParticipant", + "async": true, + "parameters": [ + { + "name": "participant", + "type": ".google.cloud.dialogflow.v2beta1.Participant" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Participant", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" + }, + "method": { + "shortName": "UpdateParticipant", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.UpdateParticipant", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Participants_AnalyzeContent_async", + "title": "dialogflow analyzeContent Sample", + "origin": "API_DEFINITION", + "description": " 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).", + "canonical": true, + "file": "participants.analyze_content.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 127, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AnalyzeContent", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent", + "async": true, + "parameters": [ + { + "name": "participant", + "type": "TYPE_STRING" + }, + { + "name": "text_input", + "type": ".google.cloud.dialogflow.v2beta1.TextInput" + }, + { + "name": "audio_input", + "type": ".google.cloud.dialogflow.v2beta1.AudioInput" + }, + { + "name": "event_input", + "type": ".google.cloud.dialogflow.v2beta1.EventInput" + }, + { + "name": "reply_audio_config", + "type": ".google.cloud.dialogflow.v2beta1.OutputAudioConfig" + }, + { + "name": "query_params", + "type": ".google.cloud.dialogflow.v2beta1.QueryParameters" + }, + { + "name": "assist_query_params", + "type": ".google.cloud.dialogflow.v2beta1.AssistQueryParameters" + }, + { + "name": "cx_parameters", + "type": ".google.protobuf.Struct" + }, + { + "name": "cx_current_page", + "type": "TYPE_STRING" + }, + { + "name": "message_send_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.AnalyzeContentResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" + }, + "method": { + "shortName": "AnalyzeContent", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Participants_StreamingAnalyzeContent_async", + "title": "dialogflow streamingAnalyzeContent Sample", + "origin": "API_DEFINITION", + "description": " Adds a text (e.g., chat) or audio (e.g., phone recording) message from a participant into the conversation. Note: This method is only available through the gRPC API (not REST). The top-level message sent to the client by the server is `StreamingAnalyzeContentResponse`. Multiple response messages can be returned in order. The first one or more messages contain the `recognition_result` field. Each result represents a more complete transcript of what the user said. The next message contains the `reply_text` field, and potentially the `reply_audio` and/or the `automated_agent_reply` fields. 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).", + "canonical": true, + "file": "participants.streaming_analyze_content.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 132, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StreamingAnalyzeContent", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent", + "async": true, + "parameters": [ + { + "name": "participant", + "type": "TYPE_STRING" + }, + { + "name": "audio_config", + "type": ".google.cloud.dialogflow.v2beta1.InputAudioConfig" + }, + { + "name": "text_config", + "type": ".google.cloud.dialogflow.v2beta1.InputTextConfig" + }, + { + "name": "reply_audio_config", + "type": ".google.cloud.dialogflow.v2beta1.OutputAudioConfig" + }, + { + "name": "input_audio", + "type": "TYPE_BYTES" + }, + { + "name": "input_text", + "type": "TYPE_STRING" + }, + { + "name": "input_dtmf", + "type": ".google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents" + }, + { + "name": "query_params", + "type": ".google.cloud.dialogflow.v2beta1.QueryParameters" + }, + { + "name": "assist_query_params", + "type": ".google.cloud.dialogflow.v2beta1.AssistQueryParameters" + }, + { + "name": "cx_parameters", + "type": ".google.protobuf.Struct" + }, + { + "name": "cx_current_page", + "type": "TYPE_STRING" + }, + { + "name": "enable_partial_automated_agent_reply", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" + }, + "method": { + "shortName": "StreamingAnalyzeContent", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Participants_SuggestArticles_async", + "title": "dialogflow suggestArticles Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "participants.suggest_articles.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SuggestArticles", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.SuggestArticles", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "latest_message", + "type": "TYPE_STRING" + }, + { + "name": "context_size", + "type": "TYPE_INT32" + }, + { + "name": "assist_query_params", + "type": ".google.cloud.dialogflow.v2beta1.AssistQueryParameters" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.SuggestArticlesResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" + }, + "method": { + "shortName": "SuggestArticles", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.SuggestArticles", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Participants_SuggestFaqAnswers_async", + "title": "dialogflow suggestFaqAnswers Sample", + "origin": "API_DEFINITION", + "description": " Gets suggested faq answers for a participant based on specific historical messages.", + "canonical": true, + "file": "participants.suggest_faq_answers.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SuggestFaqAnswers", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "latest_message", + "type": "TYPE_STRING" + }, + { + "name": "context_size", + "type": "TYPE_INT32" + }, + { + "name": "assist_query_params", + "type": ".google.cloud.dialogflow.v2beta1.AssistQueryParameters" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" + }, + "method": { + "shortName": "SuggestFaqAnswers", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Participants_SuggestSmartReplies_async", + "title": "dialogflow suggestSmartReplies Sample", + "origin": "API_DEFINITION", + "description": " Gets smart replies for a participant based on specific historical messages.", + "canonical": true, + "file": "participants.suggest_smart_replies.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SuggestSmartReplies", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.SuggestSmartReplies", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "current_text_input", + "type": ".google.cloud.dialogflow.v2beta1.TextInput" + }, + { + "name": "latest_message", + "type": "TYPE_STRING" + }, + { + "name": "context_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" + }, + "method": { + "shortName": "SuggestSmartReplies", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.SuggestSmartReplies", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Participants_ListSuggestions_async", + "title": "dialogflow listSuggestions Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "participants.list_suggestions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSuggestions", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.ListSuggestions", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListSuggestionsResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" + }, + "method": { + "shortName": "ListSuggestions", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.ListSuggestions", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Participants_CompileSuggestion_async", + "title": "dialogflow compileSuggestion Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "participants.compile_suggestion.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CompileSuggestion", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "latest_message", + "type": "TYPE_STRING" + }, + { + "name": "context_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.CompileSuggestionResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" + }, + "method": { + "shortName": "CompileSuggestion", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_SessionEntityTypes_ListSessionEntityTypes_async", + "title": "dialogflow listSessionEntityTypes Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "session_entity_types.list_session_entity_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse", + "client": { + "shortName": "SessionEntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypesClient" + }, + "method": { + "shortName": "ListSessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes", + "service": { + "shortName": "SessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_SessionEntityTypes_GetSessionEntityType_async", + "title": "dialogflow getSessionEntityType Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "session_entity_types.get_session_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSessionEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.GetSessionEntityType", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.SessionEntityType", + "client": { + "shortName": "SessionEntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypesClient" + }, + "method": { + "shortName": "GetSessionEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.GetSessionEntityType", + "service": { + "shortName": "SessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_SessionEntityTypes_CreateSessionEntityType_async", + "title": "dialogflow createSessionEntityType Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "session_entity_types.create_session_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSessionEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.CreateSessionEntityType", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "session_entity_type", + "type": ".google.cloud.dialogflow.v2beta1.SessionEntityType" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.SessionEntityType", + "client": { + "shortName": "SessionEntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypesClient" + }, + "method": { + "shortName": "CreateSessionEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.CreateSessionEntityType", + "service": { + "shortName": "SessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_SessionEntityTypes_UpdateSessionEntityType_async", + "title": "dialogflow updateSessionEntityType Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "session_entity_types.update_session_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSessionEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.UpdateSessionEntityType", + "async": true, + "parameters": [ + { + "name": "session_entity_type", + "type": ".google.cloud.dialogflow.v2beta1.SessionEntityType" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.SessionEntityType", + "client": { + "shortName": "SessionEntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypesClient" + }, + "method": { + "shortName": "UpdateSessionEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.UpdateSessionEntityType", + "service": { + "shortName": "SessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_SessionEntityTypes_DeleteSessionEntityType_async", + "title": "dialogflow deleteSessionEntityType Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "session_entity_types.delete_session_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSessionEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.DeleteSessionEntityType", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "SessionEntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypesClient" + }, + "method": { + "shortName": "DeleteSessionEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.DeleteSessionEntityType", + "service": { + "shortName": "SessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Sessions_DetectIntent_async", + "title": "dialogflow detectIntent Sample", + "origin": "API_DEFINITION", + "description": " 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. If you might use [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) or other CCAI products now or in the future, consider using [AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent] instead of `DetectIntent`. `AnalyzeContent` has additional functionality for Agent Assist and other CCAI products. Note: Always use agent versions for production traffic. See [Versions and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).", + "canonical": true, + "file": "sessions.detect_intent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 106, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DetectIntent", + "fullName": "google.cloud.dialogflow.v2beta1.Sessions.DetectIntent", + "async": true, + "parameters": [ + { + "name": "session", + "type": "TYPE_STRING" + }, + { + "name": "query_params", + "type": ".google.cloud.dialogflow.v2beta1.QueryParameters" + }, + { + "name": "query_input", + "type": ".google.cloud.dialogflow.v2beta1.QueryInput" + }, + { + "name": "output_audio_config", + "type": ".google.cloud.dialogflow.v2beta1.OutputAudioConfig" + }, + { + "name": "output_audio_config_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "input_audio", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.DetectIntentResponse", + "client": { + "shortName": "SessionsClient", + "fullName": "google.cloud.dialogflow.v2beta1.SessionsClient" + }, + "method": { + "shortName": "DetectIntent", + "fullName": "google.cloud.dialogflow.v2beta1.Sessions.DetectIntent", + "service": { + "shortName": "Sessions", + "fullName": "google.cloud.dialogflow.v2beta1.Sessions" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Sessions_StreamingDetectIntent_async", + "title": "dialogflow streamingDetectIntent Sample", + "origin": "API_DEFINITION", + "description": " 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). If you might use [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) or other CCAI products now or in the future, consider using [StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent] instead of `StreamingDetectIntent`. `StreamingAnalyzeContent` has additional functionality for Agent Assist and other CCAI products. Note: Always use agent versions for production traffic. See [Versions and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).", + "canonical": true, + "file": "sessions.streaming_detect_intent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 122, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StreamingDetectIntent", + "fullName": "google.cloud.dialogflow.v2beta1.Sessions.StreamingDetectIntent", + "async": true, + "parameters": [ + { + "name": "session", + "type": "TYPE_STRING" + }, + { + "name": "query_params", + "type": ".google.cloud.dialogflow.v2beta1.QueryParameters" + }, + { + "name": "query_input", + "type": ".google.cloud.dialogflow.v2beta1.QueryInput" + }, + { + "name": "single_utterance", + "type": "TYPE_BOOL" + }, + { + "name": "output_audio_config", + "type": ".google.cloud.dialogflow.v2beta1.OutputAudioConfig" + }, + { + "name": "output_audio_config_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "input_audio", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse", + "client": { + "shortName": "SessionsClient", + "fullName": "google.cloud.dialogflow.v2beta1.SessionsClient" + }, + "method": { + "shortName": "StreamingDetectIntent", + "fullName": "google.cloud.dialogflow.v2beta1.Sessions.StreamingDetectIntent", + "service": { + "shortName": "Sessions", + "fullName": "google.cloud.dialogflow.v2beta1.Sessions" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Versions_ListVersions_async", + "title": "dialogflow listVersions Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all versions of the specified agent.", + "canonical": true, + "file": "versions.list_versions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListVersions", + "fullName": "google.cloud.dialogflow.v2beta1.Versions.ListVersions", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListVersionsResponse", + "client": { + "shortName": "VersionsClient", + "fullName": "google.cloud.dialogflow.v2beta1.VersionsClient" + }, + "method": { + "shortName": "ListVersions", + "fullName": "google.cloud.dialogflow.v2beta1.Versions.ListVersions", + "service": { + "shortName": "Versions", + "fullName": "google.cloud.dialogflow.v2beta1.Versions" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Versions_GetVersion_async", + "title": "dialogflow getVersion Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified agent version.", + "canonical": true, + "file": "versions.get_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetVersion", + "fullName": "google.cloud.dialogflow.v2beta1.Versions.GetVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Version", + "client": { + "shortName": "VersionsClient", + "fullName": "google.cloud.dialogflow.v2beta1.VersionsClient" + }, + "method": { + "shortName": "GetVersion", + "fullName": "google.cloud.dialogflow.v2beta1.Versions.GetVersion", + "service": { + "shortName": "Versions", + "fullName": "google.cloud.dialogflow.v2beta1.Versions" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Versions_CreateVersion_async", + "title": "dialogflow createVersion Sample", + "origin": "API_DEFINITION", + "description": " Creates an agent version. The new version points to the agent instance in the \"default\" environment.", + "canonical": true, + "file": "versions.create_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateVersion", + "fullName": "google.cloud.dialogflow.v2beta1.Versions.CreateVersion", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "version", + "type": ".google.cloud.dialogflow.v2beta1.Version" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Version", + "client": { + "shortName": "VersionsClient", + "fullName": "google.cloud.dialogflow.v2beta1.VersionsClient" + }, + "method": { + "shortName": "CreateVersion", + "fullName": "google.cloud.dialogflow.v2beta1.Versions.CreateVersion", + "service": { + "shortName": "Versions", + "fullName": "google.cloud.dialogflow.v2beta1.Versions" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Versions_UpdateVersion_async", + "title": "dialogflow updateVersion Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "versions.update_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateVersion", + "fullName": "google.cloud.dialogflow.v2beta1.Versions.UpdateVersion", + "async": true, + "parameters": [ + { + "name": "version", + "type": ".google.cloud.dialogflow.v2beta1.Version" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Version", + "client": { + "shortName": "VersionsClient", + "fullName": "google.cloud.dialogflow.v2beta1.VersionsClient" + }, + "method": { + "shortName": "UpdateVersion", + "fullName": "google.cloud.dialogflow.v2beta1.Versions.UpdateVersion", + "service": { + "shortName": "Versions", + "fullName": "google.cloud.dialogflow.v2beta1.Versions" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Versions_DeleteVersion_async", + "title": "dialogflow deleteVersion Sample", + "origin": "API_DEFINITION", + "description": " Delete the specified agent version.", + "canonical": true, + "file": "versions.delete_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteVersion", + "fullName": "google.cloud.dialogflow.v2beta1.Versions.DeleteVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "VersionsClient", + "fullName": "google.cloud.dialogflow.v2beta1.VersionsClient" + }, + "method": { + "shortName": "DeleteVersion", + "fullName": "google.cloud.dialogflow.v2beta1.Versions.DeleteVersion", + "service": { + "shortName": "Versions", + "fullName": "google.cloud.dialogflow.v2beta1.Versions" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.create_version.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.create_version.js new file mode 100644 index 00000000000..73e1b0b6a17 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.create_version.js @@ -0,0 +1,69 @@ +// Copyright 2022 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'; + +function main(parent, version) { + // [START dialogflow_v2beta1_generated_Versions_CreateVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to create a version for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Required. The version to create. + */ + // const version = {} + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function callCreateVersion() { + // Construct request + const request = { + parent, + version, + }; + + // Run request + const response = await dialogflowClient.createVersion(request); + console.log(response); + } + + callCreateVersion(); + // [END dialogflow_v2beta1_generated_Versions_CreateVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.delete_version.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.delete_version.js new file mode 100644 index 00000000000..7ab8dcac00b --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.delete_version.js @@ -0,0 +1,65 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Versions_DeleteVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the version to delete. + * Supported formats: + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function callDeleteVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteVersion(request); + console.log(response); + } + + callDeleteVersion(); + // [END dialogflow_v2beta1_generated_Versions_DeleteVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.get_version.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.get_version.js new file mode 100644 index 00000000000..b164412ede8 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.get_version.js @@ -0,0 +1,65 @@ +// Copyright 2022 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'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Versions_GetVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the version. + * Supported formats: + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function callGetVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getVersion(request); + console.log(response); + } + + callGetVersion(); + // [END dialogflow_v2beta1_generated_Versions_GetVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.list_versions.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.list_versions.js new file mode 100644 index 00000000000..1e1c949724f --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.list_versions.js @@ -0,0 +1,75 @@ +// Copyright 2022 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'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Versions_ListVersions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to list all versions from. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function callListVersions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listVersionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListVersions(); + // [END dialogflow_v2beta1_generated_Versions_ListVersions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.update_version.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.update_version.js new file mode 100644 index 00000000000..fe66dcd53e4 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.update_version.js @@ -0,0 +1,70 @@ +// Copyright 2022 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'; + +function main(version, updateMask) { + // [START dialogflow_v2beta1_generated_Versions_UpdateVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The version to update. + * Supported formats: + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + */ + // const version = {} + /** + * Required. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function callUpdateVersion() { + // Construct request + const request = { + version, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateVersion(request); + console.log(response); + } + + callUpdateVersion(); + // [END dialogflow_v2beta1_generated_Versions_UpdateVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/index.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/index.ts new file mode 100644 index 00000000000..df3fdc37b98 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/index.ts @@ -0,0 +1,53 @@ +// Copyright 2022 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/google-cloud-dialogflow/v2beta1/src/v2beta1/agents_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/agents_client.ts new file mode 100644 index 00000000000..5d436e0d5f3 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/agents_client.ts @@ -0,0 +1,3414 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +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'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new AgentsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2beta1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2beta1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2beta1/{name=projects/*/operations/*}:cancel',additional_bindings: [{post: '/v2beta1/{name=projects/*/locations/*/operations/*}:cancel',}], + },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2beta1/{name=projects/*/operations/*}',additional_bindings: [{get: '/v2beta1/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2beta1/{name=projects/*}/operations',additional_bindings: [{get: '/v2beta1/{name=projects/*/locations/*}/operations',}], + }]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).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 = this._gaxModule.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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2beta1/agents.get_agent.js + * region_tag:dialogflow_v2beta1_generated_Agents_GetAgent_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.getAgent(request, options, callback); + } +/** + * 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.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 include:samples/generated/v2beta1/agents.set_agent.js + * region_tag:dialogflow_v2beta1_generated_Agents_SetAgent_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'agent.parent': request.agent!.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.setAgent(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/agents.delete_agent.js + * region_tag:dialogflow_v2beta1_generated_Agents_DeleteAgent_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteAgent(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/agents.get_validation_result.js + * region_tag:dialogflow_v2beta1_generated_Agents_GetValidationResult_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.getValidationResult(request, options, callback); + } + +/** + * Trains the specified agent. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * 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/` 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 include:samples/generated/v2beta1/agents.train_agent.js + * region_tag:dialogflow_v2beta1_generated_Agents_TrainAgent_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2beta1/agents.train_agent.js + * region_tag:dialogflow_v2beta1_generated_Agents_TrainAgent_async + */ + async checkTrainAgentProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.trainAgent, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Exports the specified agent to a ZIP file. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: {@link google.cloud.dialogflow.v2beta1.ExportAgentResponse|ExportAgentResponse} + * + * @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. + * + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2beta1/agents.export_agent.js + * region_tag:dialogflow_v2beta1_generated_Agents_ExportAgent_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2beta1/agents.export_agent.js + * region_tag:dialogflow_v2beta1_generated_Agents_ExportAgent_async + */ + async checkExportAgentProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportAgent, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * 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. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * The operation only tracks when importing is complete, 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/` 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://". + * + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @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 include:samples/generated/v2beta1/agents.import_agent.js + * region_tag:dialogflow_v2beta1_generated_Agents_ImportAgent_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2beta1/agents.import_agent.js + * region_tag:dialogflow_v2beta1_generated_Agents_ImportAgent_async + */ + async checkImportAgentProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importAgent, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * 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. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * The operation only tracks when restoring is complete, 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/` 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://". + * + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @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 include:samples/generated/v2beta1/agents.restore_agent.js + * region_tag:dialogflow_v2beta1_generated_Agents_RestoreAgent_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2beta1/agents.restore_agent.js + * region_tag:dialogflow_v2beta1_generated_Agents_RestoreAgent_async + */ + async checkRestoreAgentProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.restoreAgent, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['searchAgents']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.searchAgents.createStream( + this.innerApiCalls.searchAgents as 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 include:samples/generated/v2beta1/agents.search_agents.js + * region_tag:dialogflow_v2beta1_generated_Agents_SearchAgents_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['searchAgents']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.searchAgents.asyncIterate( + this.innerApiCalls['searchAgents'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- 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 { + if (this.agentsStub && !this._terminated) { + return this.agentsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/agents_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/agents_client_config.json new file mode 100644 index 00000000000..b73a09e593a --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/agents_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/agents_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/answer_records_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/answer_records_client.ts new file mode 100644 index 00000000000..e8edd8274e0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/answer_records_client.ts @@ -0,0 +1,2577 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new AnswerRecordsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = this._gaxModule.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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2beta1/answer_records.get_answer_record.js + * region_tag:dialogflow_v2beta1_generated_AnswerRecords_GetAnswerRecord_async + * @deprecated GetAnswerRecord is deprecated and may be removed in a future version. + */ + 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; + 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' + ] = this._gaxModule.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); + } +/** + * 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 include:samples/generated/v2beta1/answer_records.update_answer_record.js + * region_tag:dialogflow_v2beta1_generated_AnswerRecords_UpdateAnswerRecord_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'answer_record.name': request.answerRecord!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateAnswerRecord(request, options, callback); + } + + /** + * 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] + * Optional. Filters to restrict results to specific answer records. + * + * 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.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, + 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; + 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' + ] = this._gaxModule.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] + * Optional. Filters to restrict results to specific answer records. + * + * 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.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listAnswerRecords']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAnswerRecords.createStream( + this.innerApiCalls.listAnswerRecords as 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] + * Optional. Filters to restrict results to specific answer records. + * + * 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.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 include:samples/generated/v2beta1/answer_records.list_answer_records.js + * region_tag:dialogflow_v2beta1_generated_AnswerRecords_ListAnswerRecords_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listAnswerRecords']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAnswerRecords.asyncIterate( + this.innerApiCalls['listAnswerRecords'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- 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 { + if (this.answerRecordsStub && !this._terminated) { + return this.answerRecordsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/answer_records_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/answer_records_client_config.json new file mode 100644 index 00000000000..34e2ae76e6c --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/answer_records_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/answer_records_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/contexts_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/contexts_client.ts new file mode 100644 index 00000000000..daeda03c23b --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/contexts_client.ts @@ -0,0 +1,2880 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ContextsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = this._gaxModule.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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2beta1/contexts.get_context.js + * region_tag:dialogflow_v2beta1_generated_Contexts_GetContext_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getContext(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/contexts.create_context.js + * region_tag:dialogflow_v2beta1_generated_Contexts_CreateContext_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createContext(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/contexts.update_context.js + * region_tag:dialogflow_v2beta1_generated_Contexts_UpdateContext_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'context.name': request.context!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateContext(request, options, callback); + } +/** + * Deletes the specified context. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the context to delete. 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 include:samples/generated/v2beta1/contexts.delete_context.js + * region_tag:dialogflow_v2beta1_generated_Contexts_DeleteContext_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteContext(request, options, callback); + } +/** + * Deletes all active contexts in the specified session. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the session to delete all contexts from. 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 include:samples/generated/v2beta1/contexts.delete_all_contexts.js + * region_tag:dialogflow_v2beta1_generated_Contexts_DeleteAllContexts_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteAllContexts(request, options, callback); + } + + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listContexts']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listContexts.createStream( + this.innerApiCalls.listContexts as 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 include:samples/generated/v2beta1/contexts.list_contexts.js + * region_tag:dialogflow_v2beta1_generated_Contexts_ListContexts_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listContexts']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listContexts.asyncIterate( + this.innerApiCalls['listContexts'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- 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 { + if (this.contextsStub && !this._terminated) { + return this.contextsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/contexts_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/contexts_client_config.json new file mode 100644 index 00000000000..d9e5c1a5b97 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/contexts_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/contexts_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/conversation_profiles_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversation_profiles_client.ts new file mode 100644 index 00000000000..00ed24cd614 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversation_profiles_client.ts @@ -0,0 +1,3185 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ConversationProfilesClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = { + cXSecuritySettingsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securitySettings/{security_settings}' + ), + 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') + }; + + 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. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2beta1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2beta1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2beta1/{name=projects/*/operations/*}:cancel',additional_bindings: [{post: '/v2beta1/{name=projects/*/locations/*/operations/*}:cancel',}], + },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2beta1/{name=projects/*/operations/*}',additional_bindings: [{get: '/v2beta1/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2beta1/{name=projects/*}/operations',additional_bindings: [{get: '/v2beta1/{name=projects/*/locations/*}/operations',}], + }]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const setSuggestionFeatureConfigResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.ConversationProfile') as gax.protobuf.Type; + const setSuggestionFeatureConfigMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata') as gax.protobuf.Type; + const clearSuggestionFeatureConfigResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.ConversationProfile') as gax.protobuf.Type; + const clearSuggestionFeatureConfigMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + setSuggestionFeatureConfig: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + setSuggestionFeatureConfigResponse.decode.bind(setSuggestionFeatureConfigResponse), + setSuggestionFeatureConfigMetadata.decode.bind(setSuggestionFeatureConfigMetadata)), + clearSuggestionFeatureConfig: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + clearSuggestionFeatureConfigResponse.decode.bind(clearSuggestionFeatureConfigResponse), + clearSuggestionFeatureConfigMetadata.decode.bind(clearSuggestionFeatureConfigMetadata)) + }; + + // 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 = this._gaxModule.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', 'setSuggestionFeatureConfig', 'clearSuggestionFeatureConfig']; + 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] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2beta1/conversation_profiles.get_conversation_profile.js + * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_GetConversationProfile_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getConversationProfile(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/conversation_profiles.create_conversation_profile.js + * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_CreateConversationProfile_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createConversationProfile(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/conversation_profiles.update_conversation_profile.js + * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_UpdateConversationProfile_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'conversation_profile.name': request.conversationProfile!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateConversationProfile(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/conversation_profiles.delete_conversation_profile.js + * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_DeleteConversationProfile_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteConversationProfile(request, options, callback); + } + +/** + * Adds or updates a suggestion feature in a conversation profile. + * If the conversation profile contains the type of suggestion feature for + * the participant role, it will update it. Otherwise it will insert the + * suggestion feature. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata|SetSuggestionFeatureConfigOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2beta1.ConversationProfile|ConversationProfile} + * + * If a long running operation to add or update suggestion feature + * config for the same conversation profile, participant role and suggestion + * feature type exists, please cancel the existing long running operation + * before sending such request, otherwise the request will be rejected. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.conversationProfile + * Required. The Conversation Profile to add or update the suggestion feature + * config. Format: `projects//locations//conversationProfiles/`. + * @param {google.cloud.dialogflow.v2beta1.Participant.Role} request.participantRole + * Required. The participant role to add or update the suggestion feature + * config. Only HUMAN_AGENT or END_USER can be used. + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig} request.suggestionFeatureConfig + * Required. The suggestion feature config to add or 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 + * 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 include:samples/generated/v2beta1/conversation_profiles.set_suggestion_feature_config.js + * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_SetSuggestionFeatureConfig_async + */ + setSuggestionFeatureConfig( + request?: protos.google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + setSuggestionFeatureConfig( + request: protos.google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + setSuggestionFeatureConfig( + request: protos.google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + setSuggestionFeatureConfig( + request?: protos.google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigRequest, + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'conversation_profile': request.conversationProfile ?? '', + }); + this.initialize(); + return this.innerApiCalls.setSuggestionFeatureConfig(request, options, callback); + } +/** + * Check the status of the long running operation returned by `setSuggestionFeatureConfig()`. + * @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 include:samples/generated/v2beta1/conversation_profiles.set_suggestion_feature_config.js + * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_SetSuggestionFeatureConfig_async + */ + async checkSetSuggestionFeatureConfigProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.setSuggestionFeatureConfig, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Clears a suggestion feature from a conversation profile for the given + * participant role. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata|ClearSuggestionFeatureConfigOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2beta1.ConversationProfile|ConversationProfile} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.conversationProfile + * Required. The Conversation Profile to add or update the suggestion feature + * config. Format: `projects//locations//conversationProfiles/`. + * @param {google.cloud.dialogflow.v2beta1.Participant.Role} request.participantRole + * Required. The participant role to remove the suggestion feature + * config. Only HUMAN_AGENT or END_USER can be used. + * @param {google.cloud.dialogflow.v2beta1.SuggestionFeature.Type} request.suggestionFeatureType + * Required. The type of the suggestion feature to remove. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2beta1/conversation_profiles.clear_suggestion_feature_config.js + * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async + */ + clearSuggestionFeatureConfig( + request?: protos.google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + clearSuggestionFeatureConfig( + request: protos.google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + clearSuggestionFeatureConfig( + request: protos.google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + clearSuggestionFeatureConfig( + request?: protos.google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigRequest, + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'conversation_profile': request.conversationProfile ?? '', + }); + this.initialize(); + return this.innerApiCalls.clearSuggestionFeatureConfig(request, options, callback); + } +/** + * Check the status of the long running operation returned by `clearSuggestionFeatureConfig()`. + * @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 include:samples/generated/v2beta1/conversation_profiles.clear_suggestion_feature_config.js + * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async + */ + async checkClearSuggestionFeatureConfigProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.clearSuggestionFeatureConfig, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listConversationProfiles']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversationProfiles.createStream( + this.innerApiCalls.listConversationProfiles as 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 include:samples/generated/v2beta1/conversation_profiles.list_conversation_profiles.js + * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_ListConversationProfiles_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listConversationProfiles']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversationProfiles.asyncIterate( + this.innerApiCalls['listConversationProfiles'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified cXSecuritySettings resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} security_settings + * @returns {string} Resource name string. + */ + cXSecuritySettingsPath(project:string,location:string,securitySettings:string) { + return this.pathTemplates.cXSecuritySettingsPathTemplate.render({ + project: project, + location: location, + security_settings: securitySettings, + }); + } + + /** + * Parse the project from CXSecuritySettings resource. + * + * @param {string} cXSecuritySettingsName + * A fully-qualified path representing CXSecuritySettings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCXSecuritySettingsName(cXSecuritySettingsName: string) { + return this.pathTemplates.cXSecuritySettingsPathTemplate.match(cXSecuritySettingsName).project; + } + + /** + * Parse the location from CXSecuritySettings resource. + * + * @param {string} cXSecuritySettingsName + * A fully-qualified path representing CXSecuritySettings resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCXSecuritySettingsName(cXSecuritySettingsName: string) { + return this.pathTemplates.cXSecuritySettingsPathTemplate.match(cXSecuritySettingsName).location; + } + + /** + * Parse the security_settings from CXSecuritySettings resource. + * + * @param {string} cXSecuritySettingsName + * A fully-qualified path representing CXSecuritySettings resource. + * @returns {string} A string representing the security_settings. + */ + matchSecuritySettingsFromCXSecuritySettingsName(cXSecuritySettingsName: string) { + return this.pathTemplates.cXSecuritySettingsPathTemplate.match(cXSecuritySettingsName).security_settings; + } + + /** + * 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 { + if (this.conversationProfilesStub && !this._terminated) { + return this.conversationProfilesStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversation_profiles_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversation_profiles_client_config.json new file mode 100644 index 00000000000..080a39ac373 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversation_profiles_client_config.json @@ -0,0 +1,64 @@ +{ + "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" + }, + "SetSuggestionFeatureConfig": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ClearSuggestionFeatureConfig": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversation_profiles_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversation_profiles_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/conversations_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversations_client.ts new file mode 100644 index 00000000000..32746ba5051 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversations_client.ts @@ -0,0 +1,3079 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ConversationsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = this._gaxModule.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', 'suggestConversationSummary']; + 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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2beta1/conversations.create_conversation.js + * region_tag:dialogflow_v2beta1_generated_Conversations_CreateConversation_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createConversation(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/conversations.get_conversation.js + * region_tag:dialogflow_v2beta1_generated_Conversations_GetConversation_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getConversation(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/conversations.complete_conversation.js + * region_tag:dialogflow_v2beta1_generated_Conversations_CompleteConversation_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.completeConversation(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/conversations.batch_create_messages.js + * region_tag:dialogflow_v2beta1_generated_Conversations_BatchCreateMessages_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.batchCreateMessages(request, options, callback); + } +/** + * Suggest summary for a conversation based on specific historical messages. + * The range of the messages to be used for summary can be specified in the + * request. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.conversation + * Required. The conversation to fetch suggestion for. + * Format: `projects//locations//conversations/`. + * @param {string} request.latestMessage + * The name of the latest conversation message used as context for + * compiling suggestion. If empty, the latest message of the conversation will + * be used. + * + * 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 500 and at most 1000. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [SuggestConversationSummaryResponse]{@link google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v2beta1/conversations.suggest_conversation_summary.js + * region_tag:dialogflow_v2beta1_generated_Conversations_SuggestConversationSummary_async + */ + suggestConversationSummary( + request?: protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse, + protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest|undefined, {}|undefined + ]>; + suggestConversationSummary( + request: protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse, + protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest|null|undefined, + {}|null|undefined>): void; + suggestConversationSummary( + request: protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse, + protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest|null|undefined, + {}|null|undefined>): void; + suggestConversationSummary( + request?: protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse, + protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse, + protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse, + protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'conversation': request.conversation ?? '', + }); + this.initialize(); + return this.innerApiCalls.suggestConversationSummary(request, options, callback); + } + + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listConversations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversations.createStream( + this.innerApiCalls.listConversations as 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 include:samples/generated/v2beta1/conversations.list_conversations.js + * region_tag:dialogflow_v2beta1_generated_Conversations_ListConversations_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listConversations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversations.asyncIterate( + this.innerApiCalls['listConversations'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listMessages']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMessages.createStream( + this.innerApiCalls.listMessages as 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 include:samples/generated/v2beta1/conversations.list_messages.js + * region_tag:dialogflow_v2beta1_generated_Conversations_ListMessages_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listMessages']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMessages.asyncIterate( + this.innerApiCalls['listMessages'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- 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 { + if (this.conversationsStub && !this._terminated) { + return this.conversationsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversations_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversations_client_config.json new file mode 100644 index 00000000000..62968c0bd5e --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversations_client_config.json @@ -0,0 +1,64 @@ +{ + "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" + }, + "SuggestConversationSummary": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversations_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversations_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/documents_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/documents_client.ts new file mode 100644 index 00000000000..4530b779da0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/documents_client.ts @@ -0,0 +1,3331 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +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'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new DocumentsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2beta1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2beta1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2beta1/{name=projects/*/operations/*}:cancel',additional_bindings: [{post: '/v2beta1/{name=projects/*/locations/*/operations/*}:cancel',}], + },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2beta1/{name=projects/*/operations/*}',additional_bindings: [{get: '/v2beta1/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2beta1/{name=projects/*}/operations',additional_bindings: [{get: '/v2beta1/{name=projects/*/locations/*}/operations',}], + }]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).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 = this._gaxModule.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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2beta1/documents.get_document.js + * region_tag:dialogflow_v2beta1_generated_Documents_GetDocument_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getDocument(request, options, callback); + } + +/** + * Creates a new document. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata|KnowledgeOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2beta1.Document|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 include:samples/generated/v2beta1/documents.create_document.js + * region_tag:dialogflow_v2beta1_generated_Documents_CreateDocument_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2beta1/documents.create_document.js + * region_tag:dialogflow_v2beta1_generated_Documents_CreateDocument_async + */ + async checkCreateDocumentProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createDocument, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * 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. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata|KnowledgeOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2beta1.ImportDocumentsResponse|ImportDocumentsResponse} + * + * @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 include:samples/generated/v2beta1/documents.import_documents.js + * region_tag:dialogflow_v2beta1_generated_Documents_ImportDocuments_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2beta1/documents.import_documents.js + * region_tag:dialogflow_v2beta1_generated_Documents_ImportDocuments_async + */ + async checkImportDocumentsProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importDocuments, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes the specified document. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata|KnowledgeOperationMetadata} + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * 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 include:samples/generated/v2beta1/documents.delete_document.js + * region_tag:dialogflow_v2beta1_generated_Documents_DeleteDocument_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2beta1/documents.delete_document.js + * region_tag:dialogflow_v2beta1_generated_Documents_DeleteDocument_async + */ + async checkDeleteDocumentProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteDocument, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the specified document. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata|KnowledgeOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2beta1.Document|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 include:samples/generated/v2beta1/documents.update_document.js + * region_tag:dialogflow_v2beta1_generated_Documents_UpdateDocument_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2beta1/documents.update_document.js + * region_tag:dialogflow_v2beta1_generated_Documents_UpdateDocument_async + */ + async checkUpdateDocumentProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateDocument, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * 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. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata|KnowledgeOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2beta1.Document|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 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 include:samples/generated/v2beta1/documents.reload_document.js + * region_tag:dialogflow_v2beta1_generated_Documents_ReloadDocument_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2beta1/documents.reload_document.js + * region_tag:dialogflow_v2beta1_generated_Documents_ReloadDocument_async + */ + async checkReloadDocumentProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.reloadDocument, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listDocuments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDocuments.createStream( + this.innerApiCalls.listDocuments as 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 include:samples/generated/v2beta1/documents.list_documents.js + * region_tag:dialogflow_v2beta1_generated_Documents_ListDocuments_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listDocuments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDocuments.asyncIterate( + this.innerApiCalls['listDocuments'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- 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 { + if (this.documentsStub && !this._terminated) { + return this.documentsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/documents_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/documents_client_config.json new file mode 100644 index 00000000000..994669432ce --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/documents_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/documents_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/entity_types_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/entity_types_client.ts new file mode 100644 index 00000000000..f263eebf17e --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/entity_types_client.ts @@ -0,0 +1,3575 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +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'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new EntityTypesClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2beta1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2beta1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2beta1/{name=projects/*/operations/*}:cancel',additional_bindings: [{post: '/v2beta1/{name=projects/*/locations/*/operations/*}:cancel',}], + },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2beta1/{name=projects/*/operations/*}',additional_bindings: [{get: '/v2beta1/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2beta1/{name=projects/*}/operations',additional_bindings: [{get: '/v2beta1/{name=projects/*/locations/*}/operations',}], + }]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).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 = this._gaxModule.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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2beta1/entity_types.get_entity_type.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_GetEntityType_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getEntityType(request, options, callback); + } +/** + * 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. + * 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 include:samples/generated/v2beta1/entity_types.create_entity_type.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_CreateEntityType_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createEntityType(request, options, callback); + } +/** + * 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.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 include:samples/generated/v2beta1/entity_types.update_entity_type.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_UpdateEntityType_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'entity_type.name': request.entityType!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateEntityType(request, options, callback); + } +/** + * 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. + * 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 include:samples/generated/v2beta1/entity_types.delete_entity_type.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_DeleteEntityType_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteEntityType(request, options, callback); + } + +/** + * Updates/Creates multiple entity types in the specified agent. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: {@link google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse|BatchUpdateEntityTypesResponse} + * + * 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. + * 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 include:samples/generated/v2beta1/entity_types.batch_update_entity_types.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntityTypes_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2beta1/entity_types.batch_update_entity_types.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntityTypes_async + */ + async checkBatchUpdateEntityTypesProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchUpdateEntityTypes, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes entity types in the specified agent. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * 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. + * 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 include:samples/generated/v2beta1/entity_types.batch_delete_entity_types.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntityTypes_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2beta1/entity_types.batch_delete_entity_types.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntityTypes_async + */ + async checkBatchDeleteEntityTypesProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchDeleteEntityTypes, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates multiple new entities in the specified entity type. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * 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. + * 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 include:samples/generated/v2beta1/entity_types.batch_create_entities.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchCreateEntities_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2beta1/entity_types.batch_create_entities.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchCreateEntities_async + */ + async checkBatchCreateEntitiesProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchCreateEntities, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * 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). + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * @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 include:samples/generated/v2beta1/entity_types.batch_update_entities.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntities_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2beta1/entity_types.batch_update_entities.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntities_async + */ + async checkBatchUpdateEntitiesProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchUpdateEntities, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes entities in the specified entity type. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * 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. + * 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 include:samples/generated/v2beta1/entity_types.batch_delete_entities.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntities_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2beta1/entity_types.batch_delete_entities.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntities_async + */ + async checkBatchDeleteEntitiesProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchDeleteEntities, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listEntityTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEntityTypes.createStream( + this.innerApiCalls.listEntityTypes as 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 include:samples/generated/v2beta1/entity_types.list_entity_types.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_ListEntityTypes_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listEntityTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEntityTypes.asyncIterate( + this.innerApiCalls['listEntityTypes'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- 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 { + if (this.entityTypesStub && !this._terminated) { + return this.entityTypesStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/entity_types_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/entity_types_client_config.json new file mode 100644 index 00000000000..987e4260c42 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/entity_types_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/entity_types_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/environments_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/environments_client.ts new file mode 100644 index 00000000000..a850a020330 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/environments_client.ts @@ -0,0 +1,2910 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new EnvironmentsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = this._gaxModule.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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2beta1/environments.get_environment.js + * region_tag:dialogflow_v2beta1_generated_Environments_GetEnvironment_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getEnvironment(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/environments.create_environment.js + * region_tag:dialogflow_v2beta1_generated_Environments_CreateEnvironment_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createEnvironment(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/environments.update_environment.js + * region_tag:dialogflow_v2beta1_generated_Environments_UpdateEnvironment_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'environment.name': request.environment!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateEnvironment(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/environments.delete_environment.js + * region_tag:dialogflow_v2beta1_generated_Environments_DeleteEnvironment_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteEnvironment(request, options, callback); + } + + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listEnvironments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEnvironments.createStream( + this.innerApiCalls.listEnvironments as 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 include:samples/generated/v2beta1/environments.list_environments.js + * region_tag:dialogflow_v2beta1_generated_Environments_ListEnvironments_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listEnvironments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEnvironments.asyncIterate( + this.innerApiCalls['listEnvironments'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['getEnvironmentHistory']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.getEnvironmentHistory.createStream( + this.innerApiCalls.getEnvironmentHistory as 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 include:samples/generated/v2beta1/environments.get_environment_history.js + * region_tag:dialogflow_v2beta1_generated_Environments_GetEnvironmentHistory_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['getEnvironmentHistory']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.getEnvironmentHistory.asyncIterate( + this.innerApiCalls['getEnvironmentHistory'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- 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 { + if (this.environmentsStub && !this._terminated) { + return this.environmentsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/environments_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/environments_client_config.json new file mode 100644 index 00000000000..4fd9caa5715 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/environments_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/environments_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/fulfillments_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/fulfillments_client.ts new file mode 100644 index 00000000000..5f88080719a --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/fulfillments_client.ts @@ -0,0 +1,2332 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} 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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new FulfillmentsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = this._gaxModule.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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2beta1/fulfillments.get_fulfillment.js + * region_tag:dialogflow_v2beta1_generated_Fulfillments_GetFulfillment_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getFulfillment(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/fulfillments.update_fulfillment.js + * region_tag:dialogflow_v2beta1_generated_Fulfillments_UpdateFulfillment_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'fulfillment.name': request.fulfillment!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateFulfillment(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, 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 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 { + if (this.fulfillmentsStub && !this._terminated) { + return this.fulfillmentsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/fulfillments_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/fulfillments_client_config.json new file mode 100644 index 00000000000..b865673e9f2 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/fulfillments_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/fulfillments_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/gapic_metadata.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/gapic_metadata.json new file mode 100644 index 00000000000..9e1a852b6ec --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/gapic_metadata.json @@ -0,0 +1,1193 @@ +{ + "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" + ] + }, + "SetSuggestionFeatureConfig": { + "methods": [ + "setSuggestionFeatureConfig" + ] + }, + "ClearSuggestionFeatureConfig": { + "methods": [ + "clearSuggestionFeatureConfig" + ] + }, + "ListConversationProfiles": { + "methods": [ + "listConversationProfiles", + "listConversationProfilesStream", + "listConversationProfilesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ConversationProfilesClient", + "rpcs": { + "GetConversationProfile": { + "methods": [ + "getConversationProfile" + ] + }, + "CreateConversationProfile": { + "methods": [ + "createConversationProfile" + ] + }, + "UpdateConversationProfile": { + "methods": [ + "updateConversationProfile" + ] + }, + "DeleteConversationProfile": { + "methods": [ + "deleteConversationProfile" + ] + }, + "SetSuggestionFeatureConfig": { + "methods": [ + "setSuggestionFeatureConfig" + ] + }, + "ClearSuggestionFeatureConfig": { + "methods": [ + "clearSuggestionFeatureConfig" + ] + }, + "ListConversationProfiles": { + "methods": [ + "listConversationProfiles", + "listConversationProfilesStream", + "listConversationProfilesAsync" + ] + } + } + } + } + }, + "Conversations": { + "clients": { + "grpc": { + "libraryClient": "ConversationsClient", + "rpcs": { + "CreateConversation": { + "methods": [ + "createConversation" + ] + }, + "GetConversation": { + "methods": [ + "getConversation" + ] + }, + "CompleteConversation": { + "methods": [ + "completeConversation" + ] + }, + "BatchCreateMessages": { + "methods": [ + "batchCreateMessages" + ] + }, + "SuggestConversationSummary": { + "methods": [ + "suggestConversationSummary" + ] + }, + "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" + ] + }, + "SuggestConversationSummary": { + "methods": [ + "suggestConversationSummary" + ] + }, + "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" + ] + }, + "StreamingAnalyzeContent": { + "methods": [ + "streamingAnalyzeContent" + ] + }, + "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/google-cloud-dialogflow/v2beta1/src/v2beta1/index.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/index.ts new file mode 100644 index 00000000000..d11d0540360 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/index.ts @@ -0,0 +1,33 @@ +// Copyright 2022 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/google-cloud-dialogflow/v2beta1/src/v2beta1/intents_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/intents_client.ts new file mode 100644 index 00000000000..8b507401c79 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/intents_client.ts @@ -0,0 +1,3233 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +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'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new IntentsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2beta1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2beta1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2beta1/{name=projects/*/operations/*}:cancel',additional_bindings: [{post: '/v2beta1/{name=projects/*/locations/*/operations/*}:cancel',}], + },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2beta1/{name=projects/*/operations/*}',additional_bindings: [{get: '/v2beta1/{name=projects/*/locations/*/operations/*}',}], + },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2beta1/{name=projects/*}/operations',additional_bindings: [{get: '/v2beta1/{name=projects/*/locations/*}/operations',}], + }]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).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 = this._gaxModule.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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2beta1/intents.get_intent.js + * region_tag:dialogflow_v2beta1_generated_Intents_GetIntent_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getIntent(request, options, callback); + } +/** + * 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. + * 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 include:samples/generated/v2beta1/intents.create_intent.js + * region_tag:dialogflow_v2beta1_generated_Intents_CreateIntent_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createIntent(request, options, callback); + } +/** + * 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.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 include:samples/generated/v2beta1/intents.update_intent.js + * region_tag:dialogflow_v2beta1_generated_Intents_UpdateIntent_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'intent.name': request.intent!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateIntent(request, options, callback); + } +/** + * 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. + * + * 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 include:samples/generated/v2beta1/intents.delete_intent.js + * region_tag:dialogflow_v2beta1_generated_Intents_DeleteIntent_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteIntent(request, options, callback); + } + +/** + * Updates/Creates multiple intents in the specified agent. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: {@link google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse|BatchUpdateIntentsResponse} + * + * 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. + * 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 include:samples/generated/v2beta1/intents.batch_update_intents.js + * region_tag:dialogflow_v2beta1_generated_Intents_BatchUpdateIntents_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2beta1/intents.batch_update_intents.js + * region_tag:dialogflow_v2beta1_generated_Intents_BatchUpdateIntents_async + */ + async checkBatchUpdateIntentsProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchUpdateIntents, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes intents in the specified agent. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * 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. + * 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 include:samples/generated/v2beta1/intents.batch_delete_intents.js + * region_tag:dialogflow_v2beta1_generated_Intents_BatchDeleteIntents_async + */ + 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; + 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' + ] = this._gaxModule.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 include:samples/generated/v2beta1/intents.batch_delete_intents.js + * region_tag:dialogflow_v2beta1_generated_Intents_BatchDeleteIntents_async + */ + async checkBatchDeleteIntentsProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchDeleteIntents, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listIntents']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listIntents.createStream( + this.innerApiCalls.listIntents as 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 include:samples/generated/v2beta1/intents.list_intents.js + * region_tag:dialogflow_v2beta1_generated_Intents_ListIntents_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listIntents']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listIntents.asyncIterate( + this.innerApiCalls['listIntents'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- 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 { + if (this.intentsStub && !this._terminated) { + return this.intentsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/intents_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/intents_client_config.json new file mode 100644 index 00000000000..7f297576fb1 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/intents_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/intents_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/knowledge_bases_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/knowledge_bases_client.ts new file mode 100644 index 00000000000..588c7e60c03 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/knowledge_bases_client.ts @@ -0,0 +1,2791 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new KnowledgeBasesClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = this._gaxModule.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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2beta1/knowledge_bases.get_knowledge_base.js + * region_tag:dialogflow_v2beta1_generated_KnowledgeBases_GetKnowledgeBase_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getKnowledgeBase(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/knowledge_bases.create_knowledge_base.js + * region_tag:dialogflow_v2beta1_generated_KnowledgeBases_CreateKnowledgeBase_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createKnowledgeBase(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/knowledge_bases.delete_knowledge_base.js + * region_tag:dialogflow_v2beta1_generated_KnowledgeBases_DeleteKnowledgeBase_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteKnowledgeBase(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/knowledge_bases.update_knowledge_base.js + * region_tag:dialogflow_v2beta1_generated_KnowledgeBases_UpdateKnowledgeBase_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'knowledge_base.name': request.knowledgeBase!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateKnowledgeBase(request, options, callback); + } + + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listKnowledgeBases']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listKnowledgeBases.createStream( + this.innerApiCalls.listKnowledgeBases as 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 include:samples/generated/v2beta1/knowledge_bases.list_knowledge_bases.js + * region_tag:dialogflow_v2beta1_generated_KnowledgeBases_ListKnowledgeBases_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listKnowledgeBases']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listKnowledgeBases.asyncIterate( + this.innerApiCalls['listKnowledgeBases'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- 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 { + if (this.knowledgeBasesStub && !this._terminated) { + return this.knowledgeBasesStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/knowledge_bases_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/knowledge_bases_client_config.json new file mode 100644 index 00000000000..f563adcead4 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/knowledge_bases_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/knowledge_bases_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/participants_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/participants_client.ts new file mode 100644 index 00000000000..60b5182268c --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/participants_client.ts @@ -0,0 +1,3398 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform, PassThrough} from 'stream'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ParticipantsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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') + }; + + // Some of the methods on this service provide streaming responses. + // Provide descriptors for these. + this.descriptors.stream = { + streamingAnalyzeContent: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, opts.fallback === 'rest') + }; + + // 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 = this._gaxModule.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', 'streamingAnalyzeContent', 'suggestArticles', 'suggestFaqAnswers', 'suggestSmartReplies', 'listSuggestions', 'compileSuggestion']; + for (const methodName of participantsStubMethods) { + const callPromise = this.participantsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + if (methodName in this.descriptors.stream) { + const stream = new PassThrough(); + setImmediate(() => { + stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); + }); + return stream; + } + 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.stream[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2beta1/participants.create_participant.js + * region_tag:dialogflow_v2beta1_generated_Participants_CreateParticipant_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createParticipant(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/participants.get_participant.js + * region_tag:dialogflow_v2beta1_generated_Participants_GetParticipant_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getParticipant(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/participants.update_participant.js + * region_tag:dialogflow_v2beta1_generated_Participants_UpdateParticipant_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'participant.name': request.participant!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateParticipant(request, options, callback); + } +/** + * 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.AudioInput} request.audioInput + * The natural language speech audio 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.cloud.dialogflow.v2beta1.AssistQueryParameters} request.assistQueryParams + * Parameters for a human assist query. + * @param {google.protobuf.Struct} request.cxParameters + * Additional parameters to be put into Dialogflow CX session parameters. To + * remove a parameter from the session, clients should explicitly set the + * parameter value to null. + * + * Note: this field should only be used if you are connecting to a Dialogflow + * CX agent. + * @param {string} request.cxCurrentPage + * The unique identifier of the CX page to override the `current_page` in the + * session. + * Format: `projects//locations//agents//flows//pages/`. + * + * If `cx_current_page` is specified, the previous state of the session will + * be ignored by Dialogflow CX, including the [previous + * page][QueryResult.current_page] and the [previous session + * parameters][QueryResult.parameters]. In most cases, `cx_current_page` and + * `cx_parameters` should be configured together to direct a session to a + * specific state. + * + * Note: this field should only be used if you are connecting to a Dialogflow + * CX agent. + * @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 include:samples/generated/v2beta1/participants.analyze_content.js + * region_tag:dialogflow_v2beta1_generated_Participants_AnalyzeContent_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'participant': request.participant ?? '', + }); + this.initialize(); + return this.innerApiCalls.analyzeContent(request, options, callback); + } +/** + * 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 {google.cloud.dialogflow.v2beta1.AssistQueryParameters} [request.assistQueryParams] + * Optional. Parameters for a human assist query. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2beta1/participants.suggest_articles.js + * region_tag:dialogflow_v2beta1_generated_Participants_SuggestArticles_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.suggestArticles(request, options, callback); + } +/** + * 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 {google.cloud.dialogflow.v2beta1.AssistQueryParameters} [request.assistQueryParams] + * Optional. Parameters for a human assist query. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2beta1/participants.suggest_faq_answers.js + * region_tag:dialogflow_v2beta1_generated_Participants_SuggestFaqAnswers_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.suggestFaqAnswers(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/participants.suggest_smart_replies.js + * region_tag:dialogflow_v2beta1_generated_Participants_SuggestSmartReplies_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.suggestSmartReplies(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/participants.compile_suggestion.js + * region_tag:dialogflow_v2beta1_generated_Participants_CompileSuggestion_async + * @deprecated CompileSuggestion is deprecated and may be removed in a future version. + */ + 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; + 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' + ] = this._gaxModule.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); + } + +/** + * Adds a text (e.g., chat) or audio (e.g., phone recording) message from a + * participant into the conversation. + * Note: This method is only available through the gRPC API (not REST). + * + * The top-level message sent to the client by the server is + * `StreamingAnalyzeContentResponse`. Multiple response messages can be + * returned in order. The first one or more messages contain the + * `recognition_result` field. Each result represents a more complete + * transcript of what the user said. The next message contains the + * `reply_text` field, and potentially the `reply_audio` and/or the + * `automated_agent_reply` fields. + * + * 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} [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 [StreamingAnalyzeContentRequest]{@link google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest} for write() method, and + * will emit objects representing [StreamingAnalyzeContentResponse]{@link google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse} 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 include:samples/generated/v2beta1/participants.streaming_analyze_content.js + * region_tag:dialogflow_v2beta1_generated_Participants_StreamingAnalyzeContent_async + */ + streamingAnalyzeContent( + options?: CallOptions): + gax.CancellableStream { + this.initialize(); + return this.innerApiCalls.streamingAnalyzeContent(null, options); + } + + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listParticipants']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listParticipants.createStream( + this.innerApiCalls.listParticipants as 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 include:samples/generated/v2beta1/participants.list_participants.js + * region_tag:dialogflow_v2beta1_generated_Participants_ListParticipants_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listParticipants']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listParticipants.asyncIterate( + this.innerApiCalls['listParticipants'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listSuggestions']; + const callSettings = defaultCallSettings.merge(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 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 include:samples/generated/v2beta1/participants.list_suggestions.js + * region_tag:dialogflow_v2beta1_generated_Participants_ListSuggestions_async + * @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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listSuggestions']; + const callSettings = defaultCallSettings.merge(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 {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- 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 { + if (this.participantsStub && !this._terminated) { + return this.participantsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/participants_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/participants_client_config.json new file mode 100644 index 00000000000..2b59076003d --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/participants_client_config.json @@ -0,0 +1,84 @@ +{ + "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" + }, + "StreamingAnalyzeContent": { + "timeout_millis": 220000, + "retry_codes_name": "non_idempotent", + "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/google-cloud-dialogflow/v2beta1/src/v2beta1/participants_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/participants_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/session_entity_types_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/session_entity_types_client.ts new file mode 100644 index 00000000000..6089ab48f51 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/session_entity_types_client.ts @@ -0,0 +1,2823 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SessionEntityTypesClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = this._gaxModule.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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2beta1/session_entity_types.get_session_entity_type.js + * region_tag:dialogflow_v2beta1_generated_SessionEntityTypes_GetSessionEntityType_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getSessionEntityType(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/session_entity_types.create_session_entity_type.js + * region_tag:dialogflow_v2beta1_generated_SessionEntityTypes_CreateSessionEntityType_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createSessionEntityType(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/session_entity_types.update_session_entity_type.js + * region_tag:dialogflow_v2beta1_generated_SessionEntityTypes_UpdateSessionEntityType_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'session_entity_type.name': request.sessionEntityType!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateSessionEntityType(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/session_entity_types.delete_session_entity_type.js + * region_tag:dialogflow_v2beta1_generated_SessionEntityTypes_DeleteSessionEntityType_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteSessionEntityType(request, options, callback); + } + + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listSessionEntityTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSessionEntityTypes.createStream( + this.innerApiCalls.listSessionEntityTypes as 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 include:samples/generated/v2beta1/session_entity_types.list_session_entity_types.js + * region_tag:dialogflow_v2beta1_generated_SessionEntityTypes_ListSessionEntityTypes_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listSessionEntityTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSessionEntityTypes.asyncIterate( + this.innerApiCalls['listSessionEntityTypes'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- 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 { + if (this.sessionEntityTypesStub && !this._terminated) { + return this.sessionEntityTypesStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/session_entity_types_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/session_entity_types_client_config.json new file mode 100644 index 00000000000..f007c235e62 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/session_entity_types_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/session_entity_types_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/sessions_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/sessions_client.ts new file mode 100644 index 00000000000..712824633ae --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/sessions_client.ts @@ -0,0 +1,2602 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} from 'google-gax'; +import {PassThrough} from 'stream'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SessionsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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(this._gaxModule.StreamType.BIDI_STREAMING, opts.fallback === 'rest') + }; + + // 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 = this._gaxModule.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) { + if (methodName in this.descriptors.stream) { + const stream = new PassThrough(); + setImmediate(() => { + stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); + }); + return stream; + } + 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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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. + * + * If you might use + * [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) + * or other CCAI products now or in the future, consider using + * {@link google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent|AnalyzeContent} + * instead of `DetectIntent`. `AnalyzeContent` has additional + * functionality for Agent Assist and other CCAI products. + * + * 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 include:samples/generated/v2beta1/sessions.detect_intent.js + * region_tag:dialogflow_v2beta1_generated_Sessions_DetectIntent_async + */ + 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; + 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' + ] = this._gaxModule.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). + * + * If you might use + * [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) + * or other CCAI products now or in the future, consider using + * {@link google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent|StreamingAnalyzeContent} + * instead of `StreamingDetectIntent`. `StreamingAnalyzeContent` has + * additional functionality for Agent Assist and other CCAI products. + * + * 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 include:samples/generated/v2beta1/sessions.streaming_detect_intent.js + * region_tag:dialogflow_v2beta1_generated_Sessions_StreamingDetectIntent_async + */ + streamingDetectIntent( + options?: CallOptions): + gax.CancellableStream { + this.initialize(); + return this.innerApiCalls.streamingDetectIntent(null, options); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, 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 { + if (this.sessionsStub && !this._terminated) { + return this.sessionsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/sessions_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/sessions_client_config.json new file mode 100644 index 00000000000..e36850ea9dc --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/sessions_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/sessions_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/versions_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/versions_client.ts new file mode 100644 index 00000000000..80ca7b9f7c0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/versions_client.ts @@ -0,0 +1,2712 @@ +// Copyright 2022 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 type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +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}; + locationsClient: LocationsClient; + 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new VersionsClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // 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; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // 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 useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // 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 = this._gaxModule.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._opts.fallback + ); + + 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 -- + // ------------------- +/** + * 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 include:samples/generated/v2beta1/versions.get_version.js + * region_tag:dialogflow_v2beta1_generated_Versions_GetVersion_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getVersion(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/versions.create_version.js + * region_tag:dialogflow_v2beta1_generated_Versions_CreateVersion_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createVersion(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/versions.update_version.js + * region_tag:dialogflow_v2beta1_generated_Versions_UpdateVersion_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'version.name': request.version!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateVersion(request, options, callback); + } +/** + * 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 include:samples/generated/v2beta1/versions.delete_version.js + * region_tag:dialogflow_v2beta1_generated_Versions_DeleteVersion_async + */ + 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; + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteVersion(request, options, callback); + } + + /** + * 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, + 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; + 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' + ] = this._gaxModule.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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listVersions.createStream( + this.innerApiCalls.listVersions as 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 include:samples/generated/v2beta1/versions.list_versions.js + * region_tag:dialogflow_v2beta1_generated_Versions_ListVersions_async + */ + 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' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listVersions.asyncIterate( + this.innerApiCalls['listVersions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * 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.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- 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 { + if (this.versionsStub && !this._terminated) { + return this.versionsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/versions_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/versions_client_config.json new file mode 100644 index 00000000000..e748590d57d --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/versions_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/versions_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..2bd79823b3a --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,41 @@ +// Copyright 2022 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/google-cloud-dialogflow/v2beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..ca5b44bbee6 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,116 @@ +// Copyright 2022 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/google-cloud-dialogflow/v2beta1/system-test/install.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/system-test/install.ts new file mode 100644 index 00000000000..557a57558e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2022 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/google-cloud-dialogflow/v2beta1/test/gapic_agents_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_agents_v2beta1.ts new file mode 100644 index 00000000000..f65fc9b2b3b --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_agents_v2beta1.ts @@ -0,0 +1,3536 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.agentsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.agentsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAgent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAgent(request), expectedError); + const actualRequest = (client.innerApiCalls.getAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAgent with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAgent(request), expectedError); + }); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SetAgentRequest', ['agent', 'parent']); + request.agent.parent = defaultValue1; + const expectedHeaderRequestParams = `agent.parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.setAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SetAgentRequest', ['agent', 'parent']); + request.agent.parent = defaultValue1; + const expectedHeaderRequestParams = `agent.parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.setAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SetAgentRequest', ['agent', 'parent']); + request.agent.parent = defaultValue1; + const expectedHeaderRequestParams = `agent.parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setAgent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setAgent(request), expectedError); + const actualRequest = (client.innerApiCalls.setAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setAgent with closed client', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SetAgentRequest', ['agent', 'parent']); + request.agent.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setAgent(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteAgent = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAgent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.deleteAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAgent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteAgent(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAgent with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteAgent(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetValidationResultRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getValidationResult as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getValidationResult as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetValidationResultRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getValidationResult as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getValidationResult as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetValidationResultRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getValidationResult = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getValidationResult(request), expectedError); + const actualRequest = (client.innerApiCalls.getValidationResult as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getValidationResult as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getValidationResult with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetValidationResultRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getValidationResult(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.TrainAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.trainAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.trainAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.TrainAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.trainAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.trainAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.TrainAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.trainAgent = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.trainAgent(request), expectedError); + const actualRequest = (client.innerApiCalls.trainAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.trainAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.TrainAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.trainAgent = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.trainAgent(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.trainAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.trainAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ExportAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.exportAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ExportAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.exportAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ExportAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportAgent = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.exportAgent(request), expectedError); + const actualRequest = (client.innerApiCalls.exportAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ExportAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportAgent = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.exportAgent(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.exportAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ImportAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.importAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ImportAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.importAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ImportAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importAgent = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.importAgent(request), expectedError); + const actualRequest = (client.innerApiCalls.importAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ImportAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importAgent = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.importAgent(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.importAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.RestoreAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.RestoreAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.RestoreAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreAgent = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.restoreAgent(request), expectedError); + const actualRequest = (client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.RestoreAgentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreAgent = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.restoreAgent(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SearchAgentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.searchAgents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchAgents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SearchAgentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.searchAgents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchAgents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SearchAgentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.searchAgents = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.searchAgents(request), expectedError); + const actualRequest = (client.innerApiCalls.searchAgents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchAgents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SearchAgentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.searchAgents.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SearchAgentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.searchAgents.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SearchAgentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.searchAgents.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SearchAgentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.searchAgents.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + 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/google-cloud-dialogflow/v2beta1/test/gapic_answer_records_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_answer_records_v2beta1.ts new file mode 100644 index 00000000000..484004c7e24 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_answer_records_v2beta1.ts @@ -0,0 +1,2441 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.answerRecordsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.answerRecordsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getAnswerRecord as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAnswerRecord as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getAnswerRecord as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAnswerRecord as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAnswerRecord = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAnswerRecord(request), expectedError); + assert(stub.calledOnce); + const actualRequest = (client.innerApiCalls.getAnswerRecord as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getAnswerRecord as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAnswerRecord with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAnswerRecord(request), expectedError); + assert(stub.calledOnce); + }); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest', ['answerRecord', 'name']); + request.answerRecord.name = defaultValue1; + const expectedHeaderRequestParams = `answer_record.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateAnswerRecord as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAnswerRecord as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest', ['answerRecord', 'name']); + request.answerRecord.name = defaultValue1; + const expectedHeaderRequestParams = `answer_record.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateAnswerRecord as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAnswerRecord as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest', ['answerRecord', 'name']); + request.answerRecord.name = defaultValue1; + const expectedHeaderRequestParams = `answer_record.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAnswerRecord = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateAnswerRecord(request), expectedError); + const actualRequest = (client.innerApiCalls.updateAnswerRecord as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateAnswerRecord as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAnswerRecord with closed client', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest', ['answerRecord', 'name']); + request.answerRecord.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateAnswerRecord(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listAnswerRecords as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAnswerRecords as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listAnswerRecords as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAnswerRecords as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAnswerRecords = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAnswerRecords(request), expectedError); + const actualRequest = (client.innerApiCalls.listAnswerRecords as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAnswerRecords as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listAnswerRecords.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listAnswerRecords.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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/google-cloud-dialogflow/v2beta1/test/gapic_contexts_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_contexts_v2beta1.ts new file mode 100644 index 00000000000..3254ca0ee2d --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_contexts_v2beta1.ts @@ -0,0 +1,2795 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.contextsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.contextsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetContextRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getContext as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getContext as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetContextRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getContext as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getContext as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetContextRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getContext = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getContext(request), expectedError); + const actualRequest = (client.innerApiCalls.getContext as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getContext as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getContext with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetContextRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getContext(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateContextRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createContext as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createContext as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateContextRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createContext as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createContext as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateContextRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createContext = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createContext(request), expectedError); + const actualRequest = (client.innerApiCalls.createContext as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createContext as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createContext with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateContextRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createContext(request), expectedError); + }); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateContextRequest', ['context', 'name']); + request.context.name = defaultValue1; + const expectedHeaderRequestParams = `context.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateContext as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateContext as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateContextRequest', ['context', 'name']); + request.context.name = defaultValue1; + const expectedHeaderRequestParams = `context.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateContext as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateContext as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateContextRequest', ['context', 'name']); + request.context.name = defaultValue1; + const expectedHeaderRequestParams = `context.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateContext = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateContext(request), expectedError); + const actualRequest = (client.innerApiCalls.updateContext as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateContext as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateContext with closed client', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateContextRequest', ['context', 'name']); + request.context.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateContext(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteContextRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteContext = stubSimpleCall(expectedResponse); + const [response] = await client.deleteContext(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteContext as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteContext as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteContextRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.deleteContext as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteContext as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteContextRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteContext = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteContext(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteContext as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteContext as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteContext with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteContextRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteContext(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteAllContexts = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAllContexts(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteAllContexts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAllContexts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.deleteAllContexts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAllContexts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAllContexts = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteAllContexts(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteAllContexts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteAllContexts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAllContexts with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteAllContexts(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListContextsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listContexts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listContexts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListContextsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listContexts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listContexts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListContextsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listContexts = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listContexts(request), expectedError); + const actualRequest = (client.innerApiCalls.listContexts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listContexts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListContextsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listContexts.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListContextsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listContexts.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListContextsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listContexts.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListContextsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listContexts.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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/google-cloud-dialogflow/v2beta1/test/gapic_conversation_profiles_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_conversation_profiles_v2beta1.ts new file mode 100644 index 00000000000..ab51fddbba6 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_conversation_profiles_v2beta1.ts @@ -0,0 +1,3274 @@ +// Copyright 2022 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, LROperation, operationsProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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.ConversationProfilesClient', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.conversationProfilesStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.conversationProfilesStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getConversationProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConversationProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getConversationProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConversationProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConversationProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getConversationProfile(request), expectedError); + const actualRequest = (client.innerApiCalls.getConversationProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConversationProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationProfile with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getConversationProfile(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createConversationProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConversationProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createConversationProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConversationProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversationProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createConversationProfile(request), expectedError); + const actualRequest = (client.innerApiCalls.createConversationProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConversationProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationProfile with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createConversationProfile(request), expectedError); + }); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest', ['conversationProfile', 'name']); + request.conversationProfile.name = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateConversationProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConversationProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest', ['conversationProfile', 'name']); + request.conversationProfile.name = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateConversationProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConversationProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest', ['conversationProfile', 'name']); + request.conversationProfile.name = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateConversationProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateConversationProfile(request), expectedError); + const actualRequest = (client.innerApiCalls.updateConversationProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConversationProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConversationProfile with closed client', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest', ['conversationProfile', 'name']); + request.conversationProfile.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateConversationProfile(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteConversationProfile = stubSimpleCall(expectedResponse); + const [response] = await client.deleteConversationProfile(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteConversationProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.deleteConversationProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConversationProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteConversationProfile(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteConversationProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConversationProfile with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteConversationProfile(request), expectedError); + }); + }); + + describe('setSuggestionFeatureConfig', () => { + it('invokes setSuggestionFeatureConfig 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.SetSuggestionFeatureConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest', ['conversationProfile']); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.setSuggestionFeatureConfig = stubLongRunningCall(expectedResponse); + const [operation] = await client.setSuggestionFeatureConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setSuggestionFeatureConfig 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.SetSuggestionFeatureConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest', ['conversationProfile']); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.setSuggestionFeatureConfig = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setSuggestionFeatureConfig( + 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); + const actualRequest = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setSuggestionFeatureConfig with call 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.SetSuggestionFeatureConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest', ['conversationProfile']); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setSuggestionFeatureConfig = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.setSuggestionFeatureConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setSuggestionFeatureConfig with LRO 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.SetSuggestionFeatureConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest', ['conversationProfile']); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setSuggestionFeatureConfig = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.setSuggestionFeatureConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkSetSuggestionFeatureConfigProgress without error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + 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.checkSetSuggestionFeatureConfigProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkSetSuggestionFeatureConfigProgress with error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + 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.checkSetSuggestionFeatureConfigProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('clearSuggestionFeatureConfig', () => { + it('invokes clearSuggestionFeatureConfig 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.ClearSuggestionFeatureConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest', ['conversationProfile']); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.clearSuggestionFeatureConfig = stubLongRunningCall(expectedResponse); + const [operation] = await client.clearSuggestionFeatureConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes clearSuggestionFeatureConfig 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.ClearSuggestionFeatureConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest', ['conversationProfile']); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.clearSuggestionFeatureConfig = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.clearSuggestionFeatureConfig( + 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); + const actualRequest = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes clearSuggestionFeatureConfig with call 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.ClearSuggestionFeatureConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest', ['conversationProfile']); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.clearSuggestionFeatureConfig = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.clearSuggestionFeatureConfig(request), expectedError); + const actualRequest = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes clearSuggestionFeatureConfig with LRO 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.ClearSuggestionFeatureConfigRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest', ['conversationProfile']); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.clearSuggestionFeatureConfig = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.clearSuggestionFeatureConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkClearSuggestionFeatureConfigProgress without error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + 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.checkClearSuggestionFeatureConfigProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkClearSuggestionFeatureConfigProgress with error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + 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.checkClearSuggestionFeatureConfigProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listConversationProfiles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConversationProfiles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listConversationProfiles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConversationProfiles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listConversationProfiles = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listConversationProfiles(request), expectedError); + const actualRequest = (client.innerApiCalls.listConversationProfiles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConversationProfiles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listConversationProfiles.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listConversationProfiles.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listConversationProfiles.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listConversationProfiles.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('cXSecuritySettings', () => { + const fakePath = "/rendered/path/cXSecuritySettings"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + security_settings: "securitySettingsValue", + }; + const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.cXSecuritySettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.cXSecuritySettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('cXSecuritySettingsPath', () => { + const result = client.cXSecuritySettingsPath("projectValue", "locationValue", "securitySettingsValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.cXSecuritySettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromCXSecuritySettingsName', () => { + const result = client.matchProjectFromCXSecuritySettingsName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.cXSecuritySettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromCXSecuritySettingsName', () => { + const result = client.matchLocationFromCXSecuritySettingsName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.cXSecuritySettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSecuritySettingsFromCXSecuritySettingsName', () => { + const result = client.matchSecuritySettingsFromCXSecuritySettingsName(fakePath); + assert.strictEqual(result, "securitySettingsValue"); + assert((client.pathTemplates.cXSecuritySettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + 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/google-cloud-dialogflow/v2beta1/test/gapic_conversations_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_conversations_v2beta1.ts new file mode 100644 index 00000000000..67ff4c3aa6b --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_conversations_v2beta1.ts @@ -0,0 +1,2998 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.conversationsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.conversationsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateConversationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createConversation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConversation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateConversationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createConversation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConversation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateConversationRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createConversation(request), expectedError); + const actualRequest = (client.innerApiCalls.createConversation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConversation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversation with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateConversationRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createConversation(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetConversationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getConversation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConversation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetConversationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getConversation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConversation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetConversationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConversation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getConversation(request), expectedError); + const actualRequest = (client.innerApiCalls.getConversation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConversation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversation with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetConversationRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getConversation(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CompleteConversationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.completeConversation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.completeConversation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CompleteConversationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.completeConversation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.completeConversation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CompleteConversationRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.completeConversation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.completeConversation(request), expectedError); + const actualRequest = (client.innerApiCalls.completeConversation as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.completeConversation as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes completeConversation with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CompleteConversationRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.completeConversation(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchCreateMessages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateMessages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchCreateMessages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateMessages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateMessages = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.batchCreateMessages(request), expectedError); + const actualRequest = (client.innerApiCalls.batchCreateMessages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateMessages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateMessages with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.batchCreateMessages(request), expectedError); + }); + }); + + describe('suggestConversationSummary', () => { + it('invokes suggestConversationSummary 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.SuggestConversationSummaryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest', ['conversation']); + request.conversation = defaultValue1; + const expectedHeaderRequestParams = `conversation=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse() + ); + client.innerApiCalls.suggestConversationSummary = stubSimpleCall(expectedResponse); + const [response] = await client.suggestConversationSummary(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.suggestConversationSummary as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.suggestConversationSummary as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestConversationSummary 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.SuggestConversationSummaryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest', ['conversation']); + request.conversation = defaultValue1; + const expectedHeaderRequestParams = `conversation=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse() + ); + client.innerApiCalls.suggestConversationSummary = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.suggestConversationSummary( + request, + (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.suggestConversationSummary as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.suggestConversationSummary as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestConversationSummary 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.SuggestConversationSummaryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest', ['conversation']); + request.conversation = defaultValue1; + const expectedHeaderRequestParams = `conversation=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.suggestConversationSummary = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.suggestConversationSummary(request), expectedError); + const actualRequest = (client.innerApiCalls.suggestConversationSummary as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.suggestConversationSummary as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestConversationSummary with closed client', 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.SuggestConversationSummaryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest', ['conversation']); + request.conversation = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.suggestConversationSummary(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listConversations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConversations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listConversations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConversations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listConversations = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listConversations(request), expectedError); + const actualRequest = (client.innerApiCalls.listConversations as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConversations as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listConversations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listConversations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listConversations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listConversations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listMessages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMessages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listMessages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMessages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMessages = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listMessages(request), expectedError); + const actualRequest = (client.innerApiCalls.listMessages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMessages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listMessages.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listMessages.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listMessages.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listMessages.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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/google-cloud-dialogflow/v2beta1/test/gapic_documents_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_documents_v2beta1.ts new file mode 100644 index 00000000000..b957891f84a --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_documents_v2beta1.ts @@ -0,0 +1,3366 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.documentsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.documentsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDocument = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getDocument(request), expectedError); + const actualRequest = (client.innerApiCalls.getDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDocument with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getDocument(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateDocumentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateDocumentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateDocumentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDocument = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createDocument(request), expectedError); + const actualRequest = (client.innerApiCalls.createDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateDocumentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDocument = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createDocument(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.importDocuments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importDocuments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.importDocuments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importDocuments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importDocuments = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.importDocuments(request), expectedError); + const actualRequest = (client.innerApiCalls.importDocuments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importDocuments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importDocuments = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.importDocuments(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.importDocuments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.importDocuments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.deleteDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.deleteDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDocument = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteDocument(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDocument = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteDocument(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest', ['document', 'name']); + request.document.name = defaultValue1; + const expectedHeaderRequestParams = `document.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest', ['document', 'name']); + request.document.name = defaultValue1; + const expectedHeaderRequestParams = `document.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest', ['document', 'name']); + request.document.name = defaultValue1; + const expectedHeaderRequestParams = `document.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDocument = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateDocument(request), expectedError); + const actualRequest = (client.innerApiCalls.updateDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest', ['document', 'name']); + request.document.name = defaultValue1; + const expectedHeaderRequestParams = `document.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDocument = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateDocument(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.reloadDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reloadDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.reloadDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reloadDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.reloadDocument = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.reloadDocument(request), expectedError); + const actualRequest = (client.innerApiCalls.reloadDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reloadDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.reloadDocument = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.reloadDocument(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.reloadDocument as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.reloadDocument as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListDocumentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listDocuments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDocuments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListDocumentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listDocuments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDocuments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListDocumentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDocuments = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listDocuments(request), expectedError); + const actualRequest = (client.innerApiCalls.listDocuments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listDocuments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListDocumentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListDocumentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListDocumentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listDocuments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListDocumentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listDocuments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + 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/google-cloud-dialogflow/v2beta1/test/gapic_entity_types_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_entity_types_v2beta1.ts new file mode 100644 index 00000000000..9bfd1cd18d0 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_entity_types_v2beta1.ts @@ -0,0 +1,3690 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.entityTypesStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.entityTypesStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getEntityType(request), expectedError); + const actualRequest = (client.innerApiCalls.getEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEntityType with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getEntityType(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createEntityType(request), expectedError); + const actualRequest = (client.innerApiCalls.createEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEntityType with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createEntityType(request), expectedError); + }); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest', ['entityType', 'name']); + request.entityType.name = defaultValue1; + const expectedHeaderRequestParams = `entity_type.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest', ['entityType', 'name']); + request.entityType.name = defaultValue1; + const expectedHeaderRequestParams = `entity_type.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest', ['entityType', 'name']); + request.entityType.name = defaultValue1; + const expectedHeaderRequestParams = `entity_type.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateEntityType(request), expectedError); + const actualRequest = (client.innerApiCalls.updateEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEntityType with closed client', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest', ['entityType', 'name']); + request.entityType.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateEntityType(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.deleteEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.deleteEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteEntityType(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteEntityType with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteEntityType(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchUpdateEntityTypes(request), expectedError); + const actualRequest = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchUpdateEntityTypes(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchDeleteEntityTypes(request), expectedError); + const actualRequest = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchDeleteEntityTypes(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchCreateEntities as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateEntities as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchCreateEntities as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateEntities as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateEntities = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchCreateEntities(request), expectedError); + const actualRequest = (client.innerApiCalls.batchCreateEntities as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateEntities as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateEntities = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchCreateEntities(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.batchCreateEntities as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchCreateEntities as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchUpdateEntities as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntities as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchUpdateEntities as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntities as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateEntities = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchUpdateEntities(request), expectedError); + const actualRequest = (client.innerApiCalls.batchUpdateEntities as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntities as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateEntities = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchUpdateEntities(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.batchUpdateEntities as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntities as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchDeleteEntities as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntities as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchDeleteEntities as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntities as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteEntities = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchDeleteEntities(request), expectedError); + const actualRequest = (client.innerApiCalls.batchDeleteEntities as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntities as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteEntities = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchDeleteEntities(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.batchDeleteEntities as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntities as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listEntityTypes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listEntityTypes(request), expectedError); + const actualRequest = (client.innerApiCalls.listEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listEntityTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listEntityTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + 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/google-cloud-dialogflow/v2beta1/test/gapic_environments_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_environments_v2beta1.ts new file mode 100644 index 00000000000..825a4b50994 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_environments_v2beta1.ts @@ -0,0 +1,2894 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.environmentsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.environmentsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getEnvironment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEnvironment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getEnvironment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEnvironment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getEnvironment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getEnvironment(request), expectedError); + const actualRequest = (client.innerApiCalls.getEnvironment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEnvironment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEnvironment with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getEnvironment(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createEnvironment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createEnvironment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createEnvironment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createEnvironment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createEnvironment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createEnvironment(request), expectedError); + const actualRequest = (client.innerApiCalls.createEnvironment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createEnvironment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEnvironment with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createEnvironment(request), expectedError); + }); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest', ['environment', 'name']); + request.environment.name = defaultValue1; + const expectedHeaderRequestParams = `environment.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateEnvironment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateEnvironment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest', ['environment', 'name']); + request.environment.name = defaultValue1; + const expectedHeaderRequestParams = `environment.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateEnvironment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateEnvironment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest', ['environment', 'name']); + request.environment.name = defaultValue1; + const expectedHeaderRequestParams = `environment.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateEnvironment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateEnvironment(request), expectedError); + const actualRequest = (client.innerApiCalls.updateEnvironment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateEnvironment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEnvironment with closed client', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest', ['environment', 'name']); + request.environment.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateEnvironment(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteEnvironment = stubSimpleCall(expectedResponse); + const [response] = await client.deleteEnvironment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteEnvironment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteEnvironment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.deleteEnvironment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteEnvironment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteEnvironment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteEnvironment(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteEnvironment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteEnvironment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteEnvironment with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteEnvironment(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listEnvironments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listEnvironments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listEnvironments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listEnvironments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listEnvironments = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listEnvironments(request), expectedError); + const actualRequest = (client.innerApiCalls.listEnvironments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listEnvironments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listEnvironments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listEnvironments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.getEnvironmentHistory as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEnvironmentHistory as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.getEnvironmentHistory as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEnvironmentHistory as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getEnvironmentHistory = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getEnvironmentHistory(request), expectedError); + const actualRequest = (client.innerApiCalls.getEnvironmentHistory as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getEnvironmentHistory as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.getEnvironmentHistory.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.getEnvironmentHistory.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.getEnvironmentHistory.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.getEnvironmentHistory.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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/google-cloud-dialogflow/v2beta1/test/gapic_fulfillments_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_fulfillments_v2beta1.ts new file mode 100644 index 00000000000..9440aace75c --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_fulfillments_v2beta1.ts @@ -0,0 +1,2131 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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 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.FulfillmentsClient', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.fulfillmentsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.fulfillmentsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getFulfillment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFulfillment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getFulfillment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFulfillment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFulfillment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFulfillment(request), expectedError); + const actualRequest = (client.innerApiCalls.getFulfillment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFulfillment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFulfillment with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFulfillment(request), expectedError); + }); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest', ['fulfillment', 'name']); + request.fulfillment.name = defaultValue1; + const expectedHeaderRequestParams = `fulfillment.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateFulfillment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFulfillment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest', ['fulfillment', 'name']); + request.fulfillment.name = defaultValue1; + const expectedHeaderRequestParams = `fulfillment.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateFulfillment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFulfillment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest', ['fulfillment', 'name']); + request.fulfillment.name = defaultValue1; + const expectedHeaderRequestParams = `fulfillment.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFulfillment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateFulfillment(request), expectedError); + const actualRequest = (client.innerApiCalls.updateFulfillment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFulfillment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFulfillment with closed client', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest', ['fulfillment', 'name']); + request.fulfillment.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateFulfillment(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + 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/google-cloud-dialogflow/v2beta1/test/gapic_intents_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_intents_v2beta1.ts new file mode 100644 index 00000000000..091b947b4f9 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_intents_v2beta1.ts @@ -0,0 +1,3228 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.intentsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.intentsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetIntentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetIntentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetIntentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getIntent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIntent(request), expectedError); + const actualRequest = (client.innerApiCalls.getIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIntent with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetIntentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getIntent(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateIntentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateIntentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateIntentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createIntent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createIntent(request), expectedError); + const actualRequest = (client.innerApiCalls.createIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createIntent with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateIntentRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createIntent(request), expectedError); + }); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateIntentRequest', ['intent', 'name']); + request.intent.name = defaultValue1; + const expectedHeaderRequestParams = `intent.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateIntentRequest', ['intent', 'name']); + request.intent.name = defaultValue1; + const expectedHeaderRequestParams = `intent.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateIntentRequest', ['intent', 'name']); + request.intent.name = defaultValue1; + const expectedHeaderRequestParams = `intent.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateIntent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateIntent(request), expectedError); + const actualRequest = (client.innerApiCalls.updateIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateIntent with closed client', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateIntentRequest', ['intent', 'name']); + request.intent.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateIntent(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteIntentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteIntent = stubSimpleCall(expectedResponse); + const [response] = await client.deleteIntent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteIntentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.deleteIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteIntentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteIntent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteIntent(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteIntent with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteIntentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteIntent(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchUpdateIntents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateIntents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchUpdateIntents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateIntents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateIntents = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchUpdateIntents(request), expectedError); + const actualRequest = (client.innerApiCalls.batchUpdateIntents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateIntents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateIntents = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchUpdateIntents(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.batchUpdateIntents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateIntents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchDeleteIntents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteIntents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.batchDeleteIntents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteIntents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteIntents = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.batchDeleteIntents(request), expectedError); + const actualRequest = (client.innerApiCalls.batchDeleteIntents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteIntents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteIntents = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.batchDeleteIntents(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.batchDeleteIntents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteIntents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listIntents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listIntents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listIntents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listIntents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listIntents = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listIntents(request), expectedError); + const actualRequest = (client.innerApiCalls.listIntents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listIntents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listIntents.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listIntents.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listIntents.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListIntentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listIntents.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + 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/google-cloud-dialogflow/v2beta1/test/gapic_knowledge_bases_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_knowledge_bases_v2beta1.ts new file mode 100644 index 00000000000..a6a55d91bb8 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_knowledge_bases_v2beta1.ts @@ -0,0 +1,2649 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.knowledgeBasesStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.knowledgeBasesStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getKnowledgeBase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getKnowledgeBase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getKnowledgeBase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getKnowledgeBase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getKnowledgeBase = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getKnowledgeBase(request), expectedError); + const actualRequest = (client.innerApiCalls.getKnowledgeBase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getKnowledgeBase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getKnowledgeBase with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getKnowledgeBase(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createKnowledgeBase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createKnowledgeBase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createKnowledgeBase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createKnowledgeBase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createKnowledgeBase = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createKnowledgeBase(request), expectedError); + const actualRequest = (client.innerApiCalls.createKnowledgeBase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createKnowledgeBase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createKnowledgeBase with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createKnowledgeBase(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteKnowledgeBase = stubSimpleCall(expectedResponse); + const [response] = await client.deleteKnowledgeBase(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteKnowledgeBase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteKnowledgeBase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.deleteKnowledgeBase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteKnowledgeBase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteKnowledgeBase = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteKnowledgeBase(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteKnowledgeBase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteKnowledgeBase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteKnowledgeBase with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteKnowledgeBase(request), expectedError); + }); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest', ['knowledgeBase', 'name']); + request.knowledgeBase.name = defaultValue1; + const expectedHeaderRequestParams = `knowledge_base.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateKnowledgeBase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateKnowledgeBase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest', ['knowledgeBase', 'name']); + request.knowledgeBase.name = defaultValue1; + const expectedHeaderRequestParams = `knowledge_base.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateKnowledgeBase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateKnowledgeBase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest', ['knowledgeBase', 'name']); + request.knowledgeBase.name = defaultValue1; + const expectedHeaderRequestParams = `knowledge_base.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateKnowledgeBase = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateKnowledgeBase(request), expectedError); + const actualRequest = (client.innerApiCalls.updateKnowledgeBase as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateKnowledgeBase as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateKnowledgeBase with closed client', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest', ['knowledgeBase', 'name']); + request.knowledgeBase.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateKnowledgeBase(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listKnowledgeBases as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listKnowledgeBases as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listKnowledgeBases as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listKnowledgeBases as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listKnowledgeBases = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listKnowledgeBases(request), expectedError); + const actualRequest = (client.innerApiCalls.listKnowledgeBases as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listKnowledgeBases as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listKnowledgeBases.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listKnowledgeBases.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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/google-cloud-dialogflow/v2beta1/test/gapic_participants_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_participants_v2beta1.ts new file mode 100644 index 00000000000..3c5a66042db --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_participants_v2beta1.ts @@ -0,0 +1,3421 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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); +} + +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', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.participantsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.participantsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateParticipantRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createParticipant as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createParticipant as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateParticipantRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createParticipant as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createParticipant as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateParticipantRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createParticipant = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createParticipant(request), expectedError); + const actualRequest = (client.innerApiCalls.createParticipant as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createParticipant as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createParticipant with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateParticipantRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createParticipant(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetParticipantRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getParticipant as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getParticipant as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetParticipantRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getParticipant as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getParticipant as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetParticipantRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getParticipant = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getParticipant(request), expectedError); + const actualRequest = (client.innerApiCalls.getParticipant as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getParticipant as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getParticipant with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetParticipantRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getParticipant(request), expectedError); + }); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest', ['participant', 'name']); + request.participant.name = defaultValue1; + const expectedHeaderRequestParams = `participant.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateParticipant as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateParticipant as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest', ['participant', 'name']); + request.participant.name = defaultValue1; + const expectedHeaderRequestParams = `participant.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateParticipant as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateParticipant as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest', ['participant', 'name']); + request.participant.name = defaultValue1; + const expectedHeaderRequestParams = `participant.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateParticipant = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateParticipant(request), expectedError); + const actualRequest = (client.innerApiCalls.updateParticipant as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateParticipant as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateParticipant with closed client', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest', ['participant', 'name']); + request.participant.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateParticipant(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest', ['participant']); + request.participant = defaultValue1; + const expectedHeaderRequestParams = `participant=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.analyzeContent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.analyzeContent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest', ['participant']); + request.participant = defaultValue1; + const expectedHeaderRequestParams = `participant=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.analyzeContent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.analyzeContent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest', ['participant']); + request.participant = defaultValue1; + const expectedHeaderRequestParams = `participant=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.analyzeContent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.analyzeContent(request), expectedError); + const actualRequest = (client.innerApiCalls.analyzeContent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.analyzeContent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes analyzeContent with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest', ['participant']); + request.participant = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.analyzeContent(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.suggestArticles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.suggestArticles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.suggestArticles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.suggestArticles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.suggestArticles = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.suggestArticles(request), expectedError); + const actualRequest = (client.innerApiCalls.suggestArticles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.suggestArticles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestArticles with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.suggestArticles(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.suggestFaqAnswers as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.suggestFaqAnswers as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.suggestFaqAnswers as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.suggestFaqAnswers as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.suggestFaqAnswers = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.suggestFaqAnswers(request), expectedError); + const actualRequest = (client.innerApiCalls.suggestFaqAnswers as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.suggestFaqAnswers as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestFaqAnswers with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.suggestFaqAnswers(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.suggestSmartReplies as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.suggestSmartReplies as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.suggestSmartReplies as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.suggestSmartReplies as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.suggestSmartReplies = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.suggestSmartReplies(request), expectedError); + const actualRequest = (client.innerApiCalls.suggestSmartReplies as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.suggestSmartReplies as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestSmartReplies with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.suggestSmartReplies(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.compileSuggestion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.compileSuggestion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.compileSuggestion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.compileSuggestion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.compileSuggestion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.compileSuggestion(request), expectedError); + assert(stub.calledOnce); + const actualRequest = (client.innerApiCalls.compileSuggestion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.compileSuggestion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes compileSuggestion with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.compileSuggestion(request), expectedError); + assert(stub.calledOnce); + }); + }); + + describe('streamingAnalyzeContent', () => { + it('invokes streamingAnalyzeContent 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.StreamingAnalyzeContentRequest() + ); + + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse() + ); + client.innerApiCalls.streamingAnalyzeContent = stubBidiStreamingCall(expectedResponse); + const stream = client.streamingAnalyzeContent(); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse) => { + 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.streamingAnalyzeContent as SinonStub) + .getCall(0).calledWith(null)); + assert.deepStrictEqual(((stream as unknown as PassThrough) + ._transform as SinonStub).getCall(0).args[0], request); + }); + + it('invokes streamingAnalyzeContent 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.StreamingAnalyzeContentRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.streamingAnalyzeContent = stubBidiStreamingCall(undefined, expectedError); + const stream = client.streamingAnalyzeContent(); + const promise = new Promise((resolve, reject) => { + stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse) => { + resolve(response); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + await assert.rejects(promise, expectedError); + assert((client.innerApiCalls.streamingAnalyzeContent as SinonStub) + .getCall(0).calledWith(null)); + assert.deepStrictEqual(((stream as unknown as PassThrough) + ._transform as SinonStub).getCall(0).args[0], request); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListParticipantsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listParticipants as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listParticipants as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListParticipantsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listParticipants as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listParticipants as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListParticipantsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listParticipants = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listParticipants(request), expectedError); + const actualRequest = (client.innerApiCalls.listParticipants as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listParticipants as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListParticipantsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listParticipants.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListParticipantsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listParticipants.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListParticipantsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listParticipants.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListParticipantsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listParticipants.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listSuggestions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSuggestions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listSuggestions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSuggestions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSuggestions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSuggestions(request), expectedError); + assert(stub.calledOnce); + const actualRequest = (client.innerApiCalls.listSuggestions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSuggestions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listSuggestions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listSuggestions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listSuggestions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listSuggestions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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/google-cloud-dialogflow/v2beta1/test/gapic_session_entity_types_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_session_entity_types_v2beta1.ts new file mode 100644 index 00000000000..9a4a1157584 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_session_entity_types_v2beta1.ts @@ -0,0 +1,2687 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.sessionEntityTypesStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.sessionEntityTypesStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getSessionEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSessionEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getSessionEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSessionEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSessionEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSessionEntityType(request), expectedError); + const actualRequest = (client.innerApiCalls.getSessionEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSessionEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSessionEntityType with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSessionEntityType(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createSessionEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSessionEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createSessionEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSessionEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSessionEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createSessionEntityType(request), expectedError); + const actualRequest = (client.innerApiCalls.createSessionEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSessionEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSessionEntityType with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createSessionEntityType(request), expectedError); + }); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest', ['sessionEntityType', 'name']); + request.sessionEntityType.name = defaultValue1; + const expectedHeaderRequestParams = `session_entity_type.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateSessionEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSessionEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest', ['sessionEntityType', 'name']); + request.sessionEntityType.name = defaultValue1; + const expectedHeaderRequestParams = `session_entity_type.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateSessionEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSessionEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest', ['sessionEntityType', 'name']); + request.sessionEntityType.name = defaultValue1; + const expectedHeaderRequestParams = `session_entity_type.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSessionEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSessionEntityType(request), expectedError); + const actualRequest = (client.innerApiCalls.updateSessionEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSessionEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSessionEntityType with closed client', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest', ['sessionEntityType', 'name']); + request.sessionEntityType.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSessionEntityType(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteSessionEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.deleteSessionEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteSessionEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSessionEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.deleteSessionEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSessionEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSessionEntityType = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteSessionEntityType(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteSessionEntityType as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSessionEntityType as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSessionEntityType with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteSessionEntityType(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listSessionEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSessionEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listSessionEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSessionEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSessionEntityTypes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSessionEntityTypes(request), expectedError); + const actualRequest = (client.innerApiCalls.listSessionEntityTypes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSessionEntityTypes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listSessionEntityTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listSessionEntityTypes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listSessionEntityTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listSessionEntityTypes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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/google-cloud-dialogflow/v2beta1/test/gapic_sessions_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_sessions_v2beta1.ts new file mode 100644 index 00000000000..5e5ca0ff2b3 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_sessions_v2beta1.ts @@ -0,0 +1,2294 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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); +} + +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.SessionsClient', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.sessionsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.sessionsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DetectIntentRequest', ['session']); + request.session = defaultValue1; + const expectedHeaderRequestParams = `session=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.detectIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.detectIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DetectIntentRequest', ['session']); + request.session = defaultValue1; + const expectedHeaderRequestParams = `session=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.detectIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.detectIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DetectIntentRequest', ['session']); + request.session = defaultValue1; + const expectedHeaderRequestParams = `session=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.detectIntent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.detectIntent(request), expectedError); + const actualRequest = (client.innerApiCalls.detectIntent as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.detectIntent as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes detectIntent with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DetectIntentRequest', ['session']); + request.session = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.detectIntent(request), expectedError); + }); + }); + + 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).calledWith(null)); + 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).calledWith(null)); + assert.deepStrictEqual(((stream as unknown as PassThrough) + ._transform as SinonStub).getCall(0).args[0], request); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + 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/google-cloud-dialogflow/v2beta1/test/gapic_versions_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_versions_v2beta1.ts new file mode 100644 index 00000000000..7902144a2e3 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_versions_v2beta1.ts @@ -0,0 +1,2649 @@ +// Copyright 2022 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, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +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', () => { + describe('Common methods', () => { + 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 for the initialized client', done => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.versionsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.versionsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.getVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.getVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVersion with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetVersionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getVersion(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateVersionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateVersionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.createVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateVersionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.createVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createVersion with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateVersionRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createVersion(request), expectedError); + }); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateVersionRequest', ['version', 'name']); + request.version.name = defaultValue1; + const expectedHeaderRequestParams = `version.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateVersionRequest', ['version', 'name']); + request.version.name = defaultValue1; + const expectedHeaderRequestParams = `version.name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.updateVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateVersionRequest', ['version', 'name']); + request.version.name = defaultValue1; + const expectedHeaderRequestParams = `version.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.updateVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateVersion with closed client', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateVersionRequest', ['version', 'name']); + request.version.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateVersion(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteVersion = stubSimpleCall(expectedResponse); + const [response] = await client.deleteVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + 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); + const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteVersion with closed client', 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteVersionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteVersion(request), expectedError); + }); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); + const actualRequest = (client.innerApiCalls.listVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listVersions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listVersions(request), expectedError); + const actualRequest = (client.innerApiCalls.listVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + 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( + (client.descriptors.page.listVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + 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/google-cloud-dialogflow/v2beta1/tsconfig.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/webpack.config.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/webpack.config.js new file mode 100644 index 00000000000..0d2fc635111 --- /dev/null +++ b/owl-bot-staging/google-cloud-dialogflow/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 10e23784d0ccbe676104671c888beaff718bbbf9 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 22 Nov 2022 02:55:03 +0000 Subject: [PATCH 2/3] feat: added cx_current_page field to AutomatedAgentReply docs: clarified docs for Sentiment PiperOrigin-RevId: 490103678 Source-Link: https://github.com/googleapis/googleapis/commit/8f95a5f2d5032f040d93874bf8e63b33d135d11d Source-Link: https://github.com/googleapis/googleapis-gen/commit/fed1c108dbe9291c14f7f305ca1e8bf2830c9c60 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRpYWxvZ2Zsb3cvLk93bEJvdC55YW1sIiwiaCI6ImZlZDFjMTA4ZGJlOTI5MWMxNGY3ZjMwNWNhMWU4YmYyODMwYzljNjAifQ== --- .../v2/protos/google/cloud/dialogflow/v2/participant.proto | 5 +++++ .../v2/protos/google/cloud/dialogflow/v2/session.proto | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/participant.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/participant.proto index a39d49fb527..f6b385077de 100644 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/participant.proto +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/participant.proto @@ -836,6 +836,11 @@ message AutomatedAgentReply { // later reply message arrives. e.g. if the agent specified some music as // partial response, it can be cancelled. bool allow_cancellation = 8; + + // The unique identifier of the current Dialogflow CX conversation page. + // Format: `projects//locations//agents//flows//pages/`. + string cx_current_page = 11; } // Represents article answer. diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/session.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/session.proto index 107e02060a3..85119ecc531 100644 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/session.proto +++ b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/session.proto @@ -689,7 +689,9 @@ message SentimentAnalysisResult { } // The sentiment, such as positive/negative feeling or association, for a unit -// of analysis, such as the query text. +// of analysis, such as the query text. See: +// https://cloud.google.com/natural-language/docs/basics#interpreting_sentiment_analysis_values +// for how to interpret the result. message Sentiment { // Sentiment score between -1.0 (negative sentiment) and 1.0 (positive // sentiment). From ec8a666ff8946760c1f869d68eb060c27bbdeb45 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Mon, 5 Dec 2022 21:43:36 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- .../google-cloud-dialogflow/v2/.eslintignore | 7 - .../google-cloud-dialogflow/v2/.eslintrc.json | 3 - .../google-cloud-dialogflow/v2/.gitignore | 14 - .../google-cloud-dialogflow/v2/.jsdoc.js | 55 - .../google-cloud-dialogflow/v2/.mocharc.js | 33 - .../google-cloud-dialogflow/v2/.prettierrc.js | 22 - .../google-cloud-dialogflow/v2/README.md | 1 - .../v2/linkinator.config.json | 16 - .../google-cloud-dialogflow/v2/package.json | 80 - .../google/cloud/dialogflow/v2/agent.proto | 559 -- .../cloud/dialogflow/v2/answer_record.proto | 294 - .../cloud/dialogflow/v2/audio_config.proto | 452 -- .../google/cloud/dialogflow/v2/context.proto | 331 -- .../cloud/dialogflow/v2/conversation.proto | 357 -- .../dialogflow/v2/conversation_dataset.proto | 320 -- .../dialogflow/v2/conversation_event.proto | 85 - .../dialogflow/v2/conversation_model.proto | 653 --- .../dialogflow/v2/conversation_profile.proto | 753 --- .../google/cloud/dialogflow/v2/document.proto | 636 --- .../cloud/dialogflow/v2/entity_type.proto | 613 --- .../cloud/dialogflow/v2/environment.proto | 390 -- .../cloud/dialogflow/v2/fulfillment.proto | 177 - .../google/cloud/dialogflow/v2/gcs.proto | 45 - .../v2/human_agent_assistant_event.proto | 43 - .../google/cloud/dialogflow/v2/intent.proto | 1111 ---- .../cloud/dialogflow/v2/knowledge_base.proto | 262 - .../cloud/dialogflow/v2/participant.proto | 1005 ---- .../google/cloud/dialogflow/v2/session.proto | 703 --- .../dialogflow/v2/session_entity_type.proto | 313 -- .../dialogflow/v2/validation_result.proto | 74 - .../google/cloud/dialogflow/v2/version.proto | 267 - .../google/cloud/dialogflow/v2/webhook.proto | 144 - .../generated/v2/agents.delete_agent.js | 62 - .../generated/v2/agents.export_agent.js | 76 - .../samples/generated/v2/agents.get_agent.js | 62 - .../v2/agents.get_validation_result.js | 70 - .../generated/v2/agents.import_agent.js | 77 - .../generated/v2/agents.restore_agent.js | 77 - .../generated/v2/agents.search_agents.js | 73 - .../samples/generated/v2/agents.set_agent.js | 65 - .../generated/v2/agents.train_agent.js | 63 - .../v2/answer_records.list_answer_records.js | 85 - .../v2/answer_records.update_answer_record.js | 66 - .../generated/v2/contexts.create_context.js | 71 - .../v2/contexts.delete_all_contexts.js | 66 - .../generated/v2/contexts.delete_context.js | 66 - .../generated/v2/contexts.get_context.js | 66 - .../generated/v2/contexts.list_contexts.js | 77 - .../generated/v2/contexts.update_context.js | 65 - ...on_datasets.create_conversation_dataset.js | 68 - ...on_datasets.delete_conversation_dataset.js | 64 - ...ation_datasets.get_conversation_dataset.js | 63 - ...ation_datasets.import_conversation_data.js | 69 - ...ion_datasets.list_conversation_datasets.js | 73 - ...sation_models.create_conversation_model.js | 67 - ...ls.create_conversation_model_evaluation.js | 69 - ...sation_models.delete_conversation_model.js | 63 - ...sation_models.deploy_conversation_model.js | 63 - ...versation_models.get_conversation_model.js | 62 - ...odels.get_conversation_model_evaluation.js | 63 - ...els.list_conversation_model_evaluations.js | 73 - ...rsation_models.list_conversation_models.js | 73 - ...tion_models.undeploy_conversation_model.js | 63 - ...rofiles.clear_suggestion_feature_config.js | 75 - ...on_profiles.create_conversation_profile.js | 67 - ...on_profiles.delete_conversation_profile.js | 63 - ...ation_profiles.get_conversation_profile.js | 63 - ...ion_profiles.list_conversation_profiles.js | 73 - ..._profiles.set_suggestion_feature_config.js | 75 - ...on_profiles.update_conversation_profile.js | 66 - .../v2/conversations.complete_conversation.js | 63 - .../v2/conversations.create_conversation.js | 79 - .../v2/conversations.get_conversation.js | 63 - .../v2/conversations.list_conversations.js | 91 - .../v2/conversations.list_messages.js | 84 - .../generated/v2/documents.create_document.js | 69 - .../generated/v2/documents.delete_document.js | 64 - .../generated/v2/documents.export_document.js | 78 - .../generated/v2/documents.get_document.js | 63 - .../v2/documents.import_documents.js | 82 - .../generated/v2/documents.list_documents.js | 92 - .../generated/v2/documents.reload_document.js | 81 - .../generated/v2/documents.update_document.js | 68 - .../v2/entity_types.batch_create_entities.js | 76 - .../v2/entity_types.batch_delete_entities.js | 78 - .../entity_types.batch_delete_entity_types.js | 69 - .../v2/entity_types.batch_update_entities.js | 80 - .../entity_types.batch_update_entity_types.js | 86 - .../v2/entity_types.create_entity_type.js | 75 - .../v2/entity_types.delete_entity_type.js | 62 - .../v2/entity_types.get_entity_type.js | 70 - .../v2/entity_types.list_entity_types.js | 81 - .../v2/entity_types.update_entity_type.js | 73 - .../v2/environments.create_environment.js | 74 - .../v2/environments.delete_environment.js | 66 - .../v2/environments.get_environment.js | 66 - .../environments.get_environment_history.js | 77 - .../v2/environments.list_environments.js | 75 - .../v2/environments.update_environment.js | 73 - .../v2/fulfillments.get_fulfillment.js | 62 - .../v2/fulfillments.update_fulfillment.js | 67 - .../v2/intents.batch_delete_intents.js | 69 - .../v2/intents.batch_update_intents.js | 89 - .../generated/v2/intents.create_intent.js | 79 - .../generated/v2/intents.delete_intent.js | 63 - .../generated/v2/intents.get_intent.js | 74 - .../generated/v2/intents.list_intents.js | 92 - .../generated/v2/intents.update_intent.js | 77 - .../knowledge_bases.create_knowledge_base.js | 67 - .../knowledge_bases.delete_knowledge_base.js | 68 - .../v2/knowledge_bases.get_knowledge_base.js | 63 - .../knowledge_bases.list_knowledge_bases.js | 95 - .../knowledge_bases.update_knowledge_base.js | 67 - .../v2/participants.analyze_content.js | 101 - .../v2/participants.create_participant.js | 68 - .../v2/participants.get_participant.js | 63 - .../v2/participants.list_participants.js | 74 - .../participants.streaming_analyze_content.js | 125 - .../v2/participants.suggest_articles.js | 80 - .../v2/participants.suggest_faq_answers.js | 80 - .../v2/participants.suggest_smart_replies.js | 82 - .../v2/participants.update_participant.js | 66 - ...entity_types.create_session_entity_type.js | 71 - ...entity_types.delete_session_entity_type.js | 67 - ...on_entity_types.get_session_entity_type.js | 67 - ..._entity_types.list_session_entity_types.js | 77 - ...entity_types.update_session_entity_type.js | 65 - .../generated/v2/sessions.detect_intent.js | 108 - .../v2/sessions.streaming_detect_intent.js | 123 - ...t_metadata.google.cloud.dialogflow.v2.json | 4731 ----------------- .../generated/v2/versions.create_version.js | 69 - .../generated/v2/versions.delete_version.js | 65 - .../generated/v2/versions.get_version.js | 65 - .../generated/v2/versions.list_versions.js | 75 - .../generated/v2/versions.update_version.js | 70 - .../google-cloud-dialogflow/v2/src/index.ts | 57 - .../v2/src/v2/agents_client.ts | 3664 ------------- .../v2/src/v2/agents_client_config.json | 74 - .../v2/src/v2/agents_proto_list.json | 25 - .../v2/src/v2/answer_records_client.ts | 2767 ---------- .../src/v2/answer_records_client_config.json | 39 - .../v2/src/v2/answer_records_proto_list.json | 25 - .../v2/src/v2/contexts_client.ts | 3089 ----------- .../v2/src/v2/contexts_client_config.json | 59 - .../v2/src/v2/contexts_proto_list.json | 25 - .../v2/src/v2/conversation_datasets_client.ts | 3303 ------------ .../conversation_datasets_client_config.json | 54 - .../v2/conversation_datasets_proto_list.json | 25 - .../v2/src/v2/conversation_models_client.ts | 3725 ------------- .../v2/conversation_models_client_config.json | 74 - .../v2/conversation_models_proto_list.json | 25 - .../v2/src/v2/conversation_profiles_client.ts | 3445 ------------ .../conversation_profiles_client_config.json | 64 - .../v2/conversation_profiles_proto_list.json | 25 - .../v2/src/v2/conversations_client.ts | 3175 ----------- .../src/v2/conversations_client_config.json | 54 - .../v2/src/v2/conversations_proto_list.json | 25 - .../v2/src/v2/documents_client.ts | 3693 ------------- .../v2/src/v2/documents_client_config.json | 69 - .../v2/src/v2/documents_proto_list.json | 25 - .../v2/src/v2/entity_types_client.ts | 3809 ------------- .../v2/src/v2/entity_types_client_config.json | 79 - .../v2/src/v2/entity_types_proto_list.json | 25 - .../v2/src/v2/environments_client.ts | 3189 ----------- .../v2/src/v2/environments_client_config.json | 59 - .../v2/src/v2/environments_proto_list.json | 25 - .../v2/src/v2/fulfillments_client.ts | 2589 --------- .../v2/src/v2/fulfillments_client_config.json | 39 - .../v2/src/v2/fulfillments_proto_list.json | 25 - .../v2/src/v2/gapic_metadata.json | 1329 ----- .../v2/src/v2/index.ts | 35 - .../v2/src/v2/intents_client.ts | 3477 ------------ .../v2/src/v2/intents_client_config.json | 64 - .../v2/src/v2/intents_proto_list.json | 25 - .../v2/src/v2/knowledge_bases_client.ts | 3036 ----------- .../src/v2/knowledge_bases_client_config.json | 54 - .../v2/src/v2/knowledge_bases_proto_list.json | 25 - .../v2/src/v2/participants_client.ts | 3294 ------------ .../v2/src/v2/participants_client_config.json | 74 - .../v2/src/v2/participants_proto_list.json | 25 - .../v2/src/v2/session_entity_types_client.ts | 3036 ----------- .../session_entity_types_client_config.json | 54 - .../v2/session_entity_types_proto_list.json | 25 - .../v2/src/v2/sessions_client.ts | 2856 ---------- .../v2/src/v2/sessions_client_config.json | 39 - .../v2/src/v2/sessions_proto_list.json | 25 - .../v2/src/v2/versions_client.ts | 2979 ----------- .../v2/src/v2/versions_client_config.json | 54 - .../v2/src/v2/versions_proto_list.json | 25 - .../system-test/fixtures/sample/src/index.js | 43 - .../system-test/fixtures/sample/src/index.ts | 128 - .../v2/system-test/install.ts | 49 - .../v2/test/gapic_agents_v2.ts | 3766 ------------- .../v2/test/gapic_answer_records_v2.ts | 2555 --------- .../v2/test/gapic_contexts_v2.ts | 3025 ----------- .../v2/test/gapic_conversation_datasets_v2.ts | 3322 ------------ .../v2/test/gapic_conversation_models_v2.ts | 3945 -------------- .../v2/test/gapic_conversation_profiles_v2.ts | 3504 ------------ .../v2/test/gapic_conversations_v2.ts | 3012 ----------- .../v2/test/gapic_documents_v2.ts | 3750 ------------- .../v2/test/gapic_entity_types_v2.ts | 3920 -------------- .../v2/test/gapic_environments_v2.ts | 3124 ----------- .../v2/test/gapic_fulfillments_v2.ts | 2361 -------- .../v2/test/gapic_intents_v2.ts | 3458 ------------ .../v2/test/gapic_knowledge_bases_v2.ts | 2879 ---------- .../v2/test/gapic_participants_v2.ts | 3276 ------------ .../v2/test/gapic_session_entity_types_v2.ts | 2917 ---------- .../v2/test/gapic_sessions_v2.ts | 2524 --------- .../v2/test/gapic_versions_v2.ts | 2879 ---------- .../google-cloud-dialogflow/v2/tsconfig.json | 19 - .../v2/webpack.config.js | 64 - .../v2beta1/.eslintignore | 7 - .../v2beta1/.eslintrc.json | 3 - .../v2beta1/.gitignore | 14 - .../google-cloud-dialogflow/v2beta1/.jsdoc.js | 55 - .../v2beta1/.mocharc.js | 33 - .../v2beta1/.prettierrc.js | 22 - .../google-cloud-dialogflow/v2beta1/README.md | 1 - .../v2beta1/linkinator.config.json | 16 - .../v2beta1/package.json | 78 - .../cloud/dialogflow/v2beta1/agent.proto | 578 -- .../dialogflow/v2beta1/answer_record.proto | 325 -- .../dialogflow/v2beta1/audio_config.proto | 462 -- .../cloud/dialogflow/v2beta1/context.proto | 375 -- .../dialogflow/v2beta1/conversation.proto | 494 -- .../v2beta1/conversation_event.proto | 85 - .../v2beta1/conversation_profile.proto | 735 --- .../cloud/dialogflow/v2beta1/document.proto | 612 --- .../dialogflow/v2beta1/entity_type.proto | 639 --- .../dialogflow/v2beta1/environment.proto | 372 -- .../dialogflow/v2beta1/fulfillment.proto | 180 - .../google/cloud/dialogflow/v2beta1/gcs.proto | 55 - .../v2beta1/human_agent_assistant_event.proto | 50 - .../cloud/dialogflow/v2beta1/intent.proto | 1453 ----- .../dialogflow/v2beta1/knowledge_base.proto | 278 - .../dialogflow/v2beta1/participant.proto | 1429 ----- .../cloud/dialogflow/v2beta1/session.proto | 841 --- .../v2beta1/session_entity_type.proto | 351 -- .../v2beta1/validation_result.proto | 74 - .../cloud/dialogflow/v2beta1/version.proto | 261 - .../cloud/dialogflow/v2beta1/webhook.proto | 164 - .../generated/v2beta1/agents.delete_agent.js | 63 - .../generated/v2beta1/agents.export_agent.js | 77 - .../generated/v2beta1/agents.get_agent.js | 63 - .../v2beta1/agents.get_validation_result.js | 71 - .../generated/v2beta1/agents.import_agent.js | 78 - .../generated/v2beta1/agents.restore_agent.js | 78 - .../generated/v2beta1/agents.search_agents.js | 74 - .../generated/v2beta1/agents.set_agent.js | 65 - .../generated/v2beta1/agents.train_agent.js | 64 - .../answer_records.get_answer_record.js | 62 - .../answer_records.list_answer_records.js | 83 - .../answer_records.update_answer_record.js | 65 - .../v2beta1/contexts.create_context.js | 77 - .../v2beta1/contexts.delete_all_contexts.js | 72 - .../v2beta1/contexts.delete_context.js | 73 - .../generated/v2beta1/contexts.get_context.js | 73 - .../v2beta1/contexts.list_contexts.js | 83 - .../v2beta1/contexts.update_context.js | 65 - ...rofiles.clear_suggestion_feature_config.js | 75 - ...on_profiles.create_conversation_profile.js | 67 - ...on_profiles.delete_conversation_profile.js | 63 - ...ation_profiles.get_conversation_profile.js | 63 - ...ion_profiles.list_conversation_profiles.js | 73 - ..._profiles.set_suggestion_feature_config.js | 75 - ...on_profiles.update_conversation_profile.js | 66 - .../conversations.batch_create_messages.js | 70 - .../conversations.complete_conversation.js | 63 - .../conversations.create_conversation.js | 79 - .../v2beta1/conversations.get_conversation.js | 63 - .../conversations.list_conversations.js | 91 - .../v2beta1/conversations.list_messages.js | 84 - ...versations.suggest_conversation_summary.js | 77 - .../v2beta1/documents.create_document.js | 74 - .../v2beta1/documents.delete_document.js | 64 - .../v2beta1/documents.get_document.js | 63 - .../v2beta1/documents.import_documents.js | 82 - .../v2beta1/documents.list_documents.js | 92 - .../v2beta1/documents.reload_document.js | 74 - .../v2beta1/documents.update_document.js | 68 - .../entity_types.batch_create_entities.js | 79 - .../entity_types.batch_delete_entities.js | 81 - .../entity_types.batch_delete_entity_types.js | 71 - .../entity_types.batch_update_entities.js | 83 - .../entity_types.batch_update_entity_types.js | 88 - .../entity_types.create_entity_type.js | 77 - .../entity_types.delete_entity_type.js | 65 - .../v2beta1/entity_types.get_entity_type.js | 73 - .../v2beta1/entity_types.list_entity_types.js | 83 - .../entity_types.update_entity_type.js | 73 - .../environments.create_environment.js | 74 - .../environments.delete_environment.js | 65 - .../v2beta1/environments.get_environment.js | 65 - .../environments.get_environment_history.js | 76 - .../v2beta1/environments.list_environments.js | 75 - .../environments.update_environment.js | 73 - .../v2beta1/fulfillments.get_fulfillment.js | 64 - .../fulfillments.update_fulfillment.js | 67 - .../v2beta1/intents.batch_delete_intents.js | 71 - .../v2beta1/intents.batch_update_intents.js | 91 - .../v2beta1/intents.create_intent.js | 81 - .../v2beta1/intents.delete_intent.js | 65 - .../generated/v2beta1/intents.get_intent.js | 76 - .../generated/v2beta1/intents.list_intents.js | 92 - .../v2beta1/intents.update_intent.js | 77 - .../knowledge_bases.create_knowledge_base.js | 67 - .../knowledge_bases.delete_knowledge_base.js | 68 - .../knowledge_bases.get_knowledge_base.js | 63 - .../knowledge_bases.list_knowledge_bases.js | 95 - .../knowledge_bases.update_knowledge_base.js | 67 - .../v2beta1/participants.analyze_content.js | 135 - .../participants.compile_suggestion.js | 75 - .../participants.create_participant.js | 68 - .../v2beta1/participants.get_participant.js | 63 - .../v2beta1/participants.list_participants.js | 74 - .../v2beta1/participants.list_suggestions.js | 83 - .../participants.streaming_analyze_content.js | 140 - .../v2beta1/participants.suggest_articles.js | 80 - .../participants.suggest_faq_answers.js | 80 - .../participants.suggest_smart_replies.js | 82 - .../participants.update_participant.js | 66 - ...entity_types.create_session_entity_type.js | 78 - ...entity_types.delete_session_entity_type.js | 74 - ...on_entity_types.get_session_entity_type.js | 73 - ..._entity_types.list_session_entity_types.js | 84 - ...entity_types.update_session_entity_type.js | 65 - .../v2beta1/sessions.detect_intent.js | 114 - .../sessions.streaming_detect_intent.js | 130 - ...adata.google.cloud.dialogflow.v2beta1.json | 4327 --------------- .../v2beta1/versions.create_version.js | 69 - .../v2beta1/versions.delete_version.js | 65 - .../generated/v2beta1/versions.get_version.js | 65 - .../v2beta1/versions.list_versions.js | 75 - .../v2beta1/versions.update_version.js | 70 - .../v2beta1/src/index.ts | 53 - .../v2beta1/src/v2beta1/agents_client.ts | 3414 ------------ .../src/v2beta1/agents_client_config.json | 74 - .../src/v2beta1/agents_proto_list.json | 23 - .../src/v2beta1/answer_records_client.ts | 2577 --------- .../v2beta1/answer_records_client_config.json | 44 - .../v2beta1/answer_records_proto_list.json | 23 - .../v2beta1/src/v2beta1/contexts_client.ts | 2880 ---------- .../src/v2beta1/contexts_client_config.json | 59 - .../src/v2beta1/contexts_proto_list.json | 23 - .../v2beta1/conversation_profiles_client.ts | 3185 ----------- .../conversation_profiles_client_config.json | 64 - .../conversation_profiles_proto_list.json | 23 - .../src/v2beta1/conversations_client.ts | 3079 ----------- .../v2beta1/conversations_client_config.json | 64 - .../src/v2beta1/conversations_proto_list.json | 23 - .../v2beta1/src/v2beta1/documents_client.ts | 3331 ------------ .../src/v2beta1/documents_client_config.json | 64 - .../src/v2beta1/documents_proto_list.json | 23 - .../src/v2beta1/entity_types_client.ts | 3575 ------------- .../v2beta1/entity_types_client_config.json | 79 - .../src/v2beta1/entity_types_proto_list.json | 23 - .../src/v2beta1/environments_client.ts | 2910 ---------- .../v2beta1/environments_client_config.json | 59 - .../src/v2beta1/environments_proto_list.json | 23 - .../src/v2beta1/fulfillments_client.ts | 2332 -------- .../v2beta1/fulfillments_client_config.json | 39 - .../src/v2beta1/fulfillments_proto_list.json | 23 - .../v2beta1/src/v2beta1/gapic_metadata.json | 1193 ----- .../v2beta1/src/v2beta1/index.ts | 33 - .../v2beta1/src/v2beta1/intents_client.ts | 3233 ----------- .../src/v2beta1/intents_client_config.json | 64 - .../src/v2beta1/intents_proto_list.json | 23 - .../src/v2beta1/knowledge_bases_client.ts | 2791 ---------- .../knowledge_bases_client_config.json | 54 - .../v2beta1/knowledge_bases_proto_list.json | 23 - .../src/v2beta1/participants_client.ts | 3398 ------------ .../v2beta1/participants_client_config.json | 84 - .../src/v2beta1/participants_proto_list.json | 23 - .../v2beta1/session_entity_types_client.ts | 2823 ---------- .../session_entity_types_client_config.json | 54 - .../session_entity_types_proto_list.json | 23 - .../v2beta1/src/v2beta1/sessions_client.ts | 2602 --------- .../src/v2beta1/sessions_client_config.json | 39 - .../src/v2beta1/sessions_proto_list.json | 23 - .../v2beta1/src/v2beta1/versions_client.ts | 2712 ---------- .../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 | 3536 ------------ .../test/gapic_answer_records_v2beta1.ts | 2441 --------- .../v2beta1/test/gapic_contexts_v2beta1.ts | 2795 ---------- .../gapic_conversation_profiles_v2beta1.ts | 3274 ------------ .../test/gapic_conversations_v2beta1.ts | 2998 ----------- .../v2beta1/test/gapic_documents_v2beta1.ts | 3366 ------------ .../test/gapic_entity_types_v2beta1.ts | 3690 ------------- .../test/gapic_environments_v2beta1.ts | 2894 ---------- .../test/gapic_fulfillments_v2beta1.ts | 2131 -------- .../v2beta1/test/gapic_intents_v2beta1.ts | 3228 ----------- .../test/gapic_knowledge_bases_v2beta1.ts | 2649 --------- .../test/gapic_participants_v2beta1.ts | 3421 ------------ .../gapic_session_entity_types_v2beta1.ts | 2687 ---------- .../v2beta1/test/gapic_sessions_v2beta1.ts | 2294 -------- .../v2beta1/test/gapic_versions_v2beta1.ts | 2649 --------- .../v2beta1/tsconfig.json | 19 - .../v2beta1/webpack.config.js | 64 - .../cloud/dialogflow/v2/participant.proto | 5 + .../google/cloud/dialogflow/v2/session.proto | 4 +- .../dialogflow/v2beta1/participant.proto | 5 + .../cloud/dialogflow/v2beta1/session.proto | 4 +- .../protos/protos.d.ts | 12 + .../google-cloud-dialogflow/protos/protos.js | 46 + .../protos/protos.json | 8 + 409 files changed, 82 insertions(+), 247536 deletions(-) delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/.gitignore delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/README.md delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/linkinator.config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/package.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/agent.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/answer_record.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/audio_config.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/context.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_dataset.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_event.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_model.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_profile.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/document.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/entity_type.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/environment.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/fulfillment.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/gcs.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/intent.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/knowledge_base.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/participant.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/session.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/session_entity_type.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/validation_result.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/version.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/webhook.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.delete_agent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.export_agent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.get_agent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.get_validation_result.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.import_agent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.restore_agent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.search_agents.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.set_agent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.train_agent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/answer_records.list_answer_records.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/answer_records.update_answer_record.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.create_context.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.delete_all_contexts.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.delete_context.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.get_context.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.list_contexts.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.update_context.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.create_conversation_dataset.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.delete_conversation_dataset.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.get_conversation_dataset.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.import_conversation_data.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.list_conversation_datasets.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.create_conversation_model.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.create_conversation_model_evaluation.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.delete_conversation_model.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.deploy_conversation_model.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.get_conversation_model.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.get_conversation_model_evaluation.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.list_conversation_model_evaluations.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.list_conversation_models.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.undeploy_conversation_model.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.clear_suggestion_feature_config.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.create_conversation_profile.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.delete_conversation_profile.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.get_conversation_profile.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.list_conversation_profiles.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.set_suggestion_feature_config.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.update_conversation_profile.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.complete_conversation.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.create_conversation.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.get_conversation.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.list_conversations.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.list_messages.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.create_document.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.delete_document.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.export_document.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.get_document.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.import_documents.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.list_documents.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.reload_document.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.update_document.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_create_entities.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_delete_entities.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_delete_entity_types.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_update_entities.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_update_entity_types.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.create_entity_type.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.delete_entity_type.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.get_entity_type.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.list_entity_types.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.update_entity_type.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.create_environment.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.delete_environment.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.get_environment.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.get_environment_history.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.list_environments.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.update_environment.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/fulfillments.get_fulfillment.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/fulfillments.update_fulfillment.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.batch_delete_intents.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.batch_update_intents.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.create_intent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.delete_intent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.get_intent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.list_intents.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.update_intent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.create_knowledge_base.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.delete_knowledge_base.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.get_knowledge_base.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.list_knowledge_bases.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.update_knowledge_base.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.analyze_content.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.create_participant.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.get_participant.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.list_participants.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.streaming_analyze_content.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.suggest_articles.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.suggest_faq_answers.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.suggest_smart_replies.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.update_participant.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.create_session_entity_type.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.delete_session_entity_type.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.get_session_entity_type.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.list_session_entity_types.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.update_session_entity_type.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/sessions.detect_intent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/sessions.streaming_detect_intent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/snippet_metadata.google.cloud.dialogflow.v2.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.create_version.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.delete_version.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.get_version.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.list_versions.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.update_version.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/agents_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/agents_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/agents_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/answer_records_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/answer_records_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/answer_records_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/contexts_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/contexts_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/contexts_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_datasets_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_datasets_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_datasets_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_models_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_models_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_models_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_profiles_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_profiles_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_profiles_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversations_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversations_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversations_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/documents_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/documents_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/documents_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/entity_types_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/entity_types_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/entity_types_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/environments_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/environments_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/environments_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/fulfillments_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/fulfillments_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/fulfillments_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/index.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/intents_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/intents_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/intents_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/knowledge_bases_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/knowledge_bases_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/knowledge_bases_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/participants_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/participants_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/participants_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/session_entity_types_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/session_entity_types_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/session_entity_types_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/sessions_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/sessions_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/sessions_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/versions_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/versions_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/src/v2/versions_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_agents_v2.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_answer_records_v2.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_contexts_v2.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_conversation_datasets_v2.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_conversation_models_v2.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_conversation_profiles_v2.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_conversations_v2.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_documents_v2.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_entity_types_v2.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_environments_v2.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_fulfillments_v2.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_intents_v2.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_knowledge_bases_v2.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_participants_v2.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_session_entity_types_v2.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_sessions_v2.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_versions_v2.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/README.md delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/linkinator.config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/package.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/agent.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/answer_record.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/audio_config.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/context.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_event.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/document.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/entity_type.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/environment.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/fulfillment.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/gcs.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/intent.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/participant.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/session.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/validation_result.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/version.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/webhook.proto delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.delete_agent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.export_agent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.get_agent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.get_validation_result.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.import_agent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.restore_agent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.search_agents.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.set_agent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.train_agent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/answer_records.get_answer_record.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/answer_records.list_answer_records.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/answer_records.update_answer_record.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.create_context.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.delete_all_contexts.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.delete_context.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.get_context.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.list_contexts.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.update_context.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.clear_suggestion_feature_config.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.create_conversation_profile.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.delete_conversation_profile.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.get_conversation_profile.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.list_conversation_profiles.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.set_suggestion_feature_config.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.update_conversation_profile.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.batch_create_messages.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.complete_conversation.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.create_conversation.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.get_conversation.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.list_conversations.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.list_messages.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.suggest_conversation_summary.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.create_document.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.delete_document.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.get_document.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.import_documents.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.list_documents.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.reload_document.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.update_document.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_create_entities.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_delete_entities.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_delete_entity_types.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_update_entities.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_update_entity_types.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.create_entity_type.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.delete_entity_type.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.get_entity_type.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.list_entity_types.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.update_entity_type.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.create_environment.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.delete_environment.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.get_environment.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.get_environment_history.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.list_environments.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.update_environment.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/fulfillments.get_fulfillment.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/fulfillments.update_fulfillment.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.batch_delete_intents.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.batch_update_intents.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.create_intent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.delete_intent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.get_intent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.list_intents.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.update_intent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.create_knowledge_base.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.delete_knowledge_base.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.get_knowledge_base.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.list_knowledge_bases.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.update_knowledge_base.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.analyze_content.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.compile_suggestion.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.create_participant.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.get_participant.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.list_participants.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.list_suggestions.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.streaming_analyze_content.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.suggest_articles.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.suggest_faq_answers.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.suggest_smart_replies.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.update_participant.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.create_session_entity_type.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.delete_session_entity_type.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.get_session_entity_type.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.list_session_entity_types.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.update_session_entity_type.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/sessions.detect_intent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/sessions.streaming_detect_intent.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/snippet_metadata.google.cloud.dialogflow.v2beta1.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.create_version.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.delete_version.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.get_version.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.list_versions.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.update_version.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/agents_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/agents_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/agents_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/answer_records_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/answer_records_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/answer_records_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/contexts_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/contexts_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/contexts_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversation_profiles_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversation_profiles_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversation_profiles_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversations_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversations_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversations_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/documents_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/documents_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/documents_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/entity_types_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/entity_types_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/entity_types_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/environments_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/environments_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/environments_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/fulfillments_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/fulfillments_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/fulfillments_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/index.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/intents_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/intents_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/intents_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/knowledge_bases_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/knowledge_bases_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/knowledge_bases_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/participants_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/participants_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/participants_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/session_entity_types_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/session_entity_types_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/session_entity_types_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/sessions_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/sessions_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/sessions_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/versions_client.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/versions_client_config.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/versions_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_agents_v2beta1.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_answer_records_v2beta1.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_contexts_v2beta1.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_conversation_profiles_v2beta1.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_conversations_v2beta1.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_documents_v2beta1.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_entity_types_v2beta1.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_environments_v2beta1.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_fulfillments_v2beta1.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_intents_v2beta1.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_knowledge_bases_v2beta1.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_participants_v2beta1.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_session_entity_types_v2beta1.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_sessions_v2beta1.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_versions_v2beta1.ts delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-dialogflow/v2beta1/webpack.config.js diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/.eslintignore b/owl-bot-staging/google-cloud-dialogflow/v2/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/.eslintrc.json b/owl-bot-staging/google-cloud-dialogflow/v2/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/.gitignore b/owl-bot-staging/google-cloud-dialogflow/v2/.gitignore deleted file mode 100644 index 5d32b23782f..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/.jsdoc.js b/owl-bot-staging/google-cloud-dialogflow/v2/.jsdoc.js deleted file mode 100644 index fe4bcaa346d..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 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 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/dialogflow', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/.mocharc.js b/owl-bot-staging/google-cloud-dialogflow/v2/.mocharc.js deleted file mode 100644 index 481c522b00f..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 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/google-cloud-dialogflow/v2/.prettierrc.js b/owl-bot-staging/google-cloud-dialogflow/v2/.prettierrc.js deleted file mode 100644 index 494e147865d..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2022 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/google-cloud-dialogflow/v2/README.md b/owl-bot-staging/google-cloud-dialogflow/v2/README.md deleted file mode 100644 index f592662ac92..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/README.md +++ /dev/null @@ -1 +0,0 @@ -Dialogflow: Nodejs Client diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/linkinator.config.json b/owl-bot-staging/google-cloud-dialogflow/v2/linkinator.config.json deleted file mode 100644 index befd23c8633..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/package.json b/owl-bot-staging/google-cloud-dialogflow/v2/package.json deleted file mode 100644 index 812938933df..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/package.json +++ /dev/null @@ -1,80 +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 datasets", - "conversation models", - "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/ && minifyProtoJson", - "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": "^3.5.2" - }, - "devDependencies": { - "@types/mocha": "^9.1.1", - "@types/node": "^16.11.62", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^3.6.11", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.0.3", - "mocha": "^10.0.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^14.0.0", - "ts-loader": "^8.4.0", - "typescript": "^4.8.3", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/agent.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/agent.proto deleted file mode 100644 index fa16a4c2af2..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/agent.proto +++ /dev/null @@ -1,559 +0,0 @@ -// Copyright 2022 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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: An empty [Struct - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - // - `response`: An [Empty - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - // - // 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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: An empty [Struct - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - // - `response`: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse] - 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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: An empty [Struct - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - // - `response`: An [Empty - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - // - // The operation only tracks when importing is complete, 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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: An empty [Struct - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - // - `response`: An [Empty - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - // - // The operation only tracks when restoring is complete, 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; - - // Trial Edition, previously known as Standard Edition. - TIER_STANDARD = 1; - - // Essentials Edition, previously known as Enterprise Essential Edition. - TIER_ENTERPRISE = 2; - - // Essentials Edition (same as TIER_ENTERPRISE), previously known as - // Enterprise Plus Edition. - TIER_ENTERPRISE_PLUS = 3 [deprecated = true]; - } - - // 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. - // - // Dialogflow performs a write operation for the Cloud Storage object - // on the caller's behalf, so your request authentication must - // have write permissions for the object. For more information, see - // [Dialogflow access - // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). - 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://". - // - // Dialogflow performs a read operation for the Cloud Storage object - // on the caller's behalf, so your request authentication must - // have read permissions for the object. For more information, see - // [Dialogflow access - // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). - 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://". - // - // Dialogflow performs a read operation for the Cloud Storage object - // on the caller's behalf, so your request authentication must - // have read permissions for the object. For more information, see - // [Dialogflow access - // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). - 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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/answer_record.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/answer_record.proto deleted file mode 100644 index 14ab41e15ad..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/answer_record.proto +++ /dev/null @@ -1,294 +0,0 @@ -// Copyright 2022 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/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" - } - ]; - - // Optional. Filters to restrict results to specific answer records. - // - // Marked deprecated as it hasn't been, and isn't currently, supported. - // - // For more information about filtering, see - // [API Filtering](https://aip.dev/160). - string filter = 2 [ - deprecated = true, - (google.api.field_behavior) = OPTIONAL - ]; - - // 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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/audio_config.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/audio_config.proto deleted file mode 100644 index b86a9d3a1d4..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/audio_config.proto +++ /dev/null @@ -1,452 +0,0 @@ -// Copyright 2022 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"; - -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"; -option (google.api.resource_definition) = { - type: "automl.googleapis.com/Model" - pattern: "projects/{project}/locations/{location}/models/{model}" -}; -option (google.api.resource_definition) = { - type: "speech.googleapis.com/PhraseSet" - pattern: "projects/{project}/locations/{location}/phraseSets/{phrase_set}" -}; - -// 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; -} - -// 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; -} - -// 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; -} - -// 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; -} - -// 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; -} - -// 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; -} - -// 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; -} - -// 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; -} - -// [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; -} - -// A wrapper of repeated TelephonyDtmf digits. -message TelephonyDtmfEvents { - // A sequence of TelephonyDtmf digits. - repeated TelephonyDtmf dtmf_events = 1; -} - -// Configures speech transcription for [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile]. -message SpeechToTextConfig { - // 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. - // If enhanced model variant is specified and an enhanced - // version of the specified model for the language does not exist, then it - // would emit an error. - SpeechModelVariant speech_model_variant = 1; - - // Which Speech model to select. Select the model best suited to your domain - // to get best results. If a model is not explicitly specified, then a default - // model is used. - // Refer to - // [Cloud Speech API - // documentation](https://cloud.google.com/speech-to-text/docs/basics#select-model) - // for more details. - string model = 2; -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/context.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/context.proto deleted file mode 100644 index 53dc7874dd1..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/context.proto +++ /dev/null @@ -1,331 +0,0 @@ -// Copyright 2022 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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation.proto deleted file mode 100644 index 6266354ae9a..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation.proto +++ /dev/null @@ -1,357 +0,0 @@ -// Copyright 2022 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/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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_dataset.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_dataset.proto deleted file mode 100644 index 282bdda3923..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_dataset.proto +++ /dev/null @@ -1,320 +0,0 @@ -// Copyright 2022 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/gcs.proto"; -import "google/longrunning/operations.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 = "ConversationDatasetProto"; -option java_package = "com.google.cloud.dialogflow.v2"; -option objc_class_prefix = "DF"; - -// Conversation datasets. -// -// Conversation datasets contain raw conversation files and their -// customizable metadata that can be used for model training. -service ConversationDatasets { - 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 dataset. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: [CreateConversationDatasetOperationMetadata][google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata] - // - `response`: [ConversationDataset][google.cloud.dialogflow.v2.ConversationDataset] - rpc CreateConversationDataset(CreateConversationDatasetRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/locations/*}/conversationDatasets" - body: "conversation_dataset" - }; - option (google.api.method_signature) = "parent,conversation_dataset"; - option (google.longrunning.operation_info) = { - response_type: "ConversationDataset" - metadata_type: "CreateConversationDatasetOperationMetadata" - }; - } - - // Retrieves the specified conversation dataset. - rpc GetConversationDataset(GetConversationDatasetRequest) returns (ConversationDataset) { - option (google.api.http) = { - get: "/v2/{name=projects/*/conversationDatasets/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/conversationDatasets/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Returns the list of all conversation datasets in the specified - // project and location. - rpc ListConversationDatasets(ListConversationDatasetsRequest) returns (ListConversationDatasetsResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*}/conversationDatasets" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*}/conversationDatasets" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes the specified conversation dataset. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: [DeleteConversationDatasetOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata] - // - `response`: An [Empty - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - rpc DeleteConversationDataset(DeleteConversationDatasetRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/locations/*/conversationDatasets/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "DeleteConversationDatasetOperationMetadata" - }; - } - - // Import data into the specified conversation dataset. Note that it - // is not allowed to import data to a conversation dataset that - // already has data in it. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: [ImportConversationDataOperationMetadata][google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata] - // - `response`: [ImportConversationDataOperationResponse][google.cloud.dialogflow.v2.ImportConversationDataOperationResponse] - rpc ImportConversationData(ImportConversationDataRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{name=projects/*/conversationDatasets/*}:importConversationData" - body: "*" - additional_bindings { - post: "/v2/{name=projects/*/locations/*/conversationDatasets/*}:importConversationData" - body: "*" - } - }; - option (google.longrunning.operation_info) = { - response_type: "ImportConversationDataOperationResponse" - metadata_type: "ImportConversationDataOperationMetadata" - }; - } -} - -// Represents metadata of a conversation. -message ConversationInfo { - // Optional. The language code of the conversation data within this dataset. See - // https://cloud.google.com/apis/design/standard_fields for more information. - // Supports all UTF-8 languages. - string language_code = 1 [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents the configuration of importing a set of conversation files in -// Google Cloud Storage. -message InputConfig { - // Required. Where the data is from. - oneof source { - // The Cloud Storage URI has the form gs:////agent*.json. Wildcards are allowed and will be expanded into all - // matched JSON files, which will be read as one conversation per file. - GcsSources gcs_source = 1; - } -} - -// Represents a conversation dataset that a user imports raw data into. -// The data inside ConversationDataset can not be changed after -// ImportConversationData finishes (and calling ImportConversationData on a -// dataset that already has data is not allowed). -message ConversationDataset { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/ConversationDataset" - pattern: "projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}" - }; - - // Output only. ConversationDataset resource name. Format: - // `projects//locations//conversationDatasets/` - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. The display name of the dataset. Maximum of 64 bytes. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The description of the dataset. Maximum of 10000 bytes. - string description = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Creation time of this dataset. - google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Input configurations set during conversation data import. - InputConfig input_config = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Metadata set during conversation data import. - ConversationInfo conversation_info = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The number of conversations this conversation dataset contains. - int64 conversation_count = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The request message for -// [ConversationDatasets.CreateConversationDataset][google.cloud.dialogflow.v2.ConversationDatasets.CreateConversationDataset]. -message CreateConversationDatasetRequest { - // Required. The project to create conversation dataset for. Format: - // `projects//locations/` - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The conversation dataset to create. - ConversationDataset conversation_dataset = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for -// [ConversationDatasets.GetConversationDataset][google.cloud.dialogflow.v2.ConversationDatasets.GetConversationDataset]. -message GetConversationDatasetRequest { - // Required. The conversation dataset to retrieve. Format: - // `projects//locations//conversationDatasets/` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/ConversationDataset" - } - ]; -} - -// The request message for -// [ConversationDatasets.ListConversationDatasets][google.cloud.dialogflow.v2.ConversationDatasets.ListConversationDatasets]. -message ListConversationDatasetsRequest { - // Required. The project and location name to list all conversation datasets for. - // Format: `projects//locations/` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/ConversationDataset" - } - ]; - - // Optional. Maximum number of conversation datasets 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 -// [ConversationDatasets.ListConversationDatasets][google.cloud.dialogflow.v2.ConversationDatasets.ListConversationDatasets]. -message ListConversationDatasetsResponse { - // The list of datasets to return. - repeated ConversationDataset conversation_datasets = 1; - - // The token to use 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 -// [ConversationDatasets.DeleteConversationDataset][google.cloud.dialogflow.v2.ConversationDatasets.DeleteConversationDataset]. -message DeleteConversationDatasetRequest { - // Required. The conversation dataset to delete. Format: - // `projects//locations//conversationDatasets/` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/ConversationDataset" - } - ]; -} - -// The request message for [ConversationDatasets.ImportConversationData][google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData]. -message ImportConversationDataRequest { - // Required. Dataset resource name. Format: - // `projects//locations//conversationDatasets/` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/ConversationDataset" - } - ]; - - // Required. Configuration describing where to import data from. - InputConfig input_config = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Metadata for a [ConversationDatasets.ImportConversationData][google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData] operation. -message ImportConversationDataOperationMetadata { - // The resource name of the imported conversation dataset. Format: - // `projects//locations//conversationDatasets/` - string conversation_dataset = 1 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/ConversationDataset" - }]; - - // Partial failures are failures that don't fail the whole long running - // operation, e.g. single files that couldn't be read. - repeated google.rpc.Status partial_failures = 2; - - // Timestamp when import conversation data request was created. The time is - // measured on server side. - google.protobuf.Timestamp create_time = 3; -} - -// Response used for [ConversationDatasets.ImportConversationData][google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData] long -// running operation. -message ImportConversationDataOperationResponse { - // The resource name of the imported conversation dataset. Format: - // `projects//locations//conversationDatasets/` - string conversation_dataset = 1 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/ConversationDataset" - }]; - - // Number of conversations imported successfully. - int32 import_count = 3; -} - -// Metadata for [ConversationDatasets][CreateConversationDataset]. -message CreateConversationDatasetOperationMetadata { - // The resource name of the conversation dataset that will be created. Format: - // `projects//locations//conversationDatasets/` - string conversation_dataset = 1 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/ConversationDataset" - }]; -} - -// Metadata for [ConversationDatasets][DeleteConversationDataset]. -message DeleteConversationDatasetOperationMetadata { - -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_event.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_event.proto deleted file mode 100644 index 6c45e895f14..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_event.proto +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2022 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"; - -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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_model.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_model.proto deleted file mode 100644 index 065290df5f0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_model.proto +++ /dev/null @@ -1,653 +0,0 @@ -// Copyright 2022 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/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 = "ConversationModelProto"; -option java_package = "com.google.cloud.dialogflow.v2"; -option objc_class_prefix = "DF"; - -// Manages a collection of models for human agent assistant. -service ConversationModels { - 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 model. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: [CreateConversationModelOperationMetadata][google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata] - // - `response`: [ConversationModel][google.cloud.dialogflow.v2.ConversationModel] - rpc CreateConversationModel(CreateConversationModelRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/conversationModels" - body: "conversation_model" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*}/conversationModels" - body: "conversation_model" - } - }; - option (google.api.method_signature) = "parent,conversation_model"; - option (google.longrunning.operation_info) = { - response_type: "ConversationModel" - metadata_type: "CreateConversationModelOperationMetadata" - }; - } - - // Gets conversation model. - rpc GetConversationModel(GetConversationModelRequest) returns (ConversationModel) { - option (google.api.http) = { - get: "/v2/{name=projects/*/conversationModels/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/conversationModels/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Lists conversation models. - rpc ListConversationModels(ListConversationModelsRequest) returns (ListConversationModelsResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*}/conversationModels" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*}/conversationModels" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a model. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: [DeleteConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata] - // - `response`: An [Empty - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - rpc DeleteConversationModel(DeleteConversationModelRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/conversationModels/*}" - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/conversationModels/*}" - } - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "DeleteConversationModelOperationMetadata" - }; - } - - // Deploys a model. If a model is already deployed, deploying it - // has no effect. A model can only serve prediction requests after it gets - // deployed. For article suggestion, custom model will not be used unless - // it is deployed. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: [DeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata] - // - `response`: An [Empty - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - rpc DeployConversationModel(DeployConversationModelRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{name=projects/*/conversationModels/*}:deploy" - body: "*" - additional_bindings { - post: "/v2/{name=projects/*/locations/*/conversationModels/*}:deploy" - body: "*" - } - }; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "DeployConversationModelOperationMetadata" - }; - } - - // Undeploys a model. If the model is not deployed this method has no effect. - // If the model is currently being used: - // - For article suggestion, article suggestion will fallback to the default - // model if model is undeployed. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: [UndeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata] - // - `response`: An [Empty - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - rpc UndeployConversationModel(UndeployConversationModelRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{name=projects/*/conversationModels/*}:undeploy" - body: "*" - additional_bindings { - post: "/v2/{name=projects/*/locations/*/conversationModels/*}:undeploy" - body: "*" - } - }; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "UndeployConversationModelOperationMetadata" - }; - } - - // Gets an evaluation of conversation model. - rpc GetConversationModelEvaluation(GetConversationModelEvaluationRequest) returns (ConversationModelEvaluation) { - option (google.api.http) = { - get: "/v2/{name=projects/*/conversationModels/*/evaluations/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/conversationModels/*/evaluations/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Lists evaluations of a conversation model. - rpc ListConversationModelEvaluations(ListConversationModelEvaluationsRequest) returns (ListConversationModelEvaluationsResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/conversationModels/*}/evaluations" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*/conversationModels/*}/evaluations" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Creates evaluation of a conversation model. - rpc CreateConversationModelEvaluation(CreateConversationModelEvaluationRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/locations/*/conversationModels/*}/evaluations" - body: "*" - }; - option (google.api.method_signature) = "parent,conversation_model_evaluation"; - option (google.longrunning.operation_info) = { - response_type: "ConversationModelEvaluation" - metadata_type: "CreateConversationModelEvaluationOperationMetadata" - }; - } -} - -// Represents a conversation model. -message ConversationModel { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/ConversationModel" - pattern: "projects/{project}/locations/{location}/conversationModels/{conversation_model}" - pattern: "projects/{project}/conversationModels/{conversation_model}" - }; - - // State of the model. - enum State { - // Should not be used, an un-set enum has this value by default. - STATE_UNSPECIFIED = 0; - - // Model being created. - CREATING = 1; - - // Model is not deployed but ready to deploy. - UNDEPLOYED = 2; - - // Model is deploying. - DEPLOYING = 3; - - // Model is deployed and ready to use. - DEPLOYED = 4; - - // Model is undeploying. - UNDEPLOYING = 5; - - // Model is deleting. - DELETING = 6; - - // Model is in error state. Not ready to deploy and use. - FAILED = 7; - - // Model is being created but the training has not started, - // The model may remain in this state until there is enough capacity to - // start training. - PENDING = 8; - } - - // Model type. - enum ModelType { - // ModelType unspecified. - MODEL_TYPE_UNSPECIFIED = 0; - - // ModelType smart reply dual encoder model. - SMART_REPLY_DUAL_ENCODER_MODEL = 2; - - // ModelType smart reply bert model. - SMART_REPLY_BERT_MODEL = 6; - } - - // ConversationModel resource name. Format: - // `projects//conversationModels/` - string name = 1; - - // Required. The display name of the model. At most 64 bytes long. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Output only. Creation time of this model. - google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Datasets used to create model. - repeated InputDataset datasets = 4 [(google.api.field_behavior) = REQUIRED]; - - // Output only. State of the model. A model can only serve prediction requests - // after it gets deployed. - State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Language code for the conversation model. If not specified, the language - // is en-US. Language at ConversationModel should be set for all non en-us - // languages. - // This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) - // language tag. Example: "en-US". - string language_code = 19; - - // Required. - // The model metadata that is specific to the problem type. - // Must match the metadata type of the dataset used to train the model. - oneof model_metadata { - // Metadata for article suggestion models. - ArticleSuggestionModelMetadata article_suggestion_model_metadata = 8; - - // Metadata for smart reply models. - SmartReplyModelMetadata smart_reply_model_metadata = 9; - } -} - -// Represents evaluation result of a conversation model. -message ConversationModelEvaluation { - option (google.api.resource) = { - type: "dialogflow.googleapis.com/ConversationModelEvaluation" - pattern: "projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}" - pattern: "projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}" - }; - - // The resource name of the evaluation. Format: - // `projects//conversationModels//evaluations/` - string name = 1; - - // Optional. The display name of the model evaluation. At most 64 bytes long. - string display_name = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The configuration of the evaluation task. - EvaluationConfig evaluation_config = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Creation time of this model. - google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Metrics details. - oneof metrics { - // Output only. Only available when model is for smart reply. - SmartReplyMetrics smart_reply_metrics = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - } -} - -// The configuration for model evaluation. -message EvaluationConfig { - // Smart reply specific configuration for evaluation job. - message SmartReplyConfig { - // The allowlist document resource name. - // Format: `projects//knowledgeBases//documents/`. Only used for smart reply model. - string allowlist_document = 1 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Document" - }]; - - // Required. The model to be evaluated can return multiple results with confidence - // score on each query. These results will be sorted by the descending order - // of the scores and we only keep the first max_result_count results as the - // final results to evaluate. - int32 max_result_count = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // Smart compose specific configuration for evaluation job. - message SmartComposeConfig { - // The allowlist document resource name. - // Format: `projects//knowledgeBases//documents/`. Only used for smart compose model. - string allowlist_document = 1 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Document" - }]; - - // Required. The model to be evaluated can return multiple results with confidence - // score on each query. These results will be sorted by the descending order - // of the scores and we only keep the first max_result_count results as the - // final results to evaluate. - int32 max_result_count = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // Required. Datasets used for evaluation. - repeated InputDataset datasets = 3 [(google.api.field_behavior) = REQUIRED]; - - // Specific configurations for different models in order to do evaluation. - oneof model_specific_config { - // Configuration for smart reply model evalution. - SmartReplyConfig smart_reply_config = 2; - - // Configuration for smart compose model evalution. - SmartComposeConfig smart_compose_config = 4; - } -} - -// InputDataset used to create model or do evaluation. -// NextID:5 -message InputDataset { - // Required. ConversationDataset resource name. Format: - // `projects//locations//conversationDatasets/` - string dataset = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/ConversationDataset" - } - ]; -} - -// Metadata for article suggestion models. -message ArticleSuggestionModelMetadata { - // Optional. Type of the article suggestion model. If not provided, model_type is used. - ConversationModel.ModelType training_model_type = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Metadata for smart reply models. -message SmartReplyModelMetadata { - // Optional. Type of the smart reply model. If not provided, model_type is used. - ConversationModel.ModelType training_model_type = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// The evaluation metrics for smart reply model. -message SmartReplyMetrics { - // Evaluation metrics when retrieving `n` smart replies with the model. - message TopNMetrics { - // Number of retrieved smart replies. For example, when `n` is 3, this - // evaluation contains metrics for when Dialogflow retrieves 3 smart replies - // with the model. - int32 n = 1; - - // Defined as `number of queries whose top n smart replies have at least one - // similar (token match similarity above the defined threshold) reply as the - // real reply` divided by `number of queries with at least one smart reply`. - // Value ranges from 0.0 to 1.0 inclusive. - float recall = 2; - } - - // Percentage of target participant messages in the evaluation dataset for - // which similar messages have appeared at least once in the allowlist. Should - // be [0, 1]. - float allowlist_coverage = 1; - - // Metrics of top n smart replies, sorted by [TopNMetric.n][]. - repeated TopNMetrics top_n_metrics = 2; - - // Total number of conversations used to generate this metric. - int64 conversation_count = 3; -} - -// The request message for -// [ConversationModels.CreateConversationModel][google.cloud.dialogflow.v2.ConversationModels.CreateConversationModel] -message CreateConversationModelRequest { - // The project to create conversation model for. Format: - // `projects/` - string parent = 1; - - // Required. The conversation model to create. - ConversationModel conversation_model = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for -// [ConversationModels.GetConversationModel][google.cloud.dialogflow.v2.ConversationModels.GetConversationModel] -message GetConversationModelRequest { - // Required. The conversation model to retrieve. Format: - // `projects//conversationModels/` - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for -// [ConversationModels.ListConversationModels][google.cloud.dialogflow.v2.ConversationModels.ListConversationModels] -message ListConversationModelsRequest { - // Required. The project to list all conversation models for. - // Format: `projects/` - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Maximum number of conversation models 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 -// [ConversationModels.ListConversationModels][google.cloud.dialogflow.v2.ConversationModels.ListConversationModels] -message ListConversationModelsResponse { - // The list of models to return. - repeated ConversationModel conversation_models = 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 -// [ConversationModels.DeleteConversationModel][google.cloud.dialogflow.v2.ConversationModels.DeleteConversationModel] -message DeleteConversationModelRequest { - // Required. The conversation model to delete. Format: - // `projects//conversationModels/` - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for -// [ConversationModels.DeployConversationModel][google.cloud.dialogflow.v2.ConversationModels.DeployConversationModel] -message DeployConversationModelRequest { - // Required. The conversation model to deploy. Format: - // `projects//conversationModels/` - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for -// [ConversationModels.UndeployConversationModel][google.cloud.dialogflow.v2.ConversationModels.UndeployConversationModel] -message UndeployConversationModelRequest { - // Required. The conversation model to undeploy. Format: - // `projects//conversationModels/` - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for -// [ConversationModels.GetConversationModelEvaluation][google.cloud.dialogflow.v2.ConversationModels.GetConversationModelEvaluation] -message GetConversationModelEvaluationRequest { - // Required. The conversation model evaluation resource name. Format: - // `projects//conversationModels//evaluations/` - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for -// [ConversationModels.ListConversationModelEvaluations][google.cloud.dialogflow.v2.ConversationModels.ListConversationModelEvaluations] -message ListConversationModelEvaluationsRequest { - // Required. The conversation model resource name. Format: - // `projects//conversationModels/` - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Maximum number of evaluations 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 -// [ConversationModels.ListConversationModelEvaluations][google.cloud.dialogflow.v2.ConversationModels.ListConversationModelEvaluations] -message ListConversationModelEvaluationsResponse { - // The list of evaluations to return. - repeated ConversationModelEvaluation conversation_model_evaluations = 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 -// [ConversationModels.CreateConversationModelEvaluation][google.cloud.dialogflow.v2.ConversationModels.CreateConversationModelEvaluation] -message CreateConversationModelEvaluationRequest { - // Required. The conversation model resource name. Format: - // `projects//locations//conversationModels/` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dialogflow.googleapis.com/ConversationModelEvaluation" - } - ]; - - // Required. The conversation model evaluation to be created. - ConversationModelEvaluation conversation_model_evaluation = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Metadata for a [ConversationModels.CreateConversationModel][google.cloud.dialogflow.v2.ConversationModels.CreateConversationModel] operation. -message CreateConversationModelOperationMetadata { - // State of CreateConversationModel operation. - enum State { - // Invalid. - STATE_UNSPECIFIED = 0; - - // Request is submitted, but training has not started yet. - // The model may remain in this state until there is enough capacity to - // start training. - PENDING = 1; - - // The training has succeeded. - SUCCEEDED = 2; - - // The training has succeeded. - FAILED = 3; - - // The training has been cancelled. - CANCELLED = 4; - - // The training is in cancelling state. - CANCELLING = 5; - - // Custom model is training. - TRAINING = 6; - } - - // The resource name of the conversation model. Format: - // `projects//conversationModels/` - string conversation_model = 1; - - // State of CreateConversationModel operation. - State state = 2; - - // Timestamp when the request to create conversation model is submitted. The - // time is measured on server side. - google.protobuf.Timestamp create_time = 3; -} - -// Metadata for a [ConversationModels.DeployConversationModel][google.cloud.dialogflow.v2.ConversationModels.DeployConversationModel] operation. -message DeployConversationModelOperationMetadata { - // The resource name of the conversation model. Format: - // `projects//conversationModels/` - string conversation_model = 1; - - // Timestamp when request to deploy conversation model was submitted. The time - // is measured on server side. - google.protobuf.Timestamp create_time = 3; -} - -// Metadata for a [ConversationModels.UndeployConversationModel][google.cloud.dialogflow.v2.ConversationModels.UndeployConversationModel] operation. -message UndeployConversationModelOperationMetadata { - // The resource name of the conversation model. Format: - // `projects//conversationModels/` - string conversation_model = 1; - - // Timestamp when the request to undeploy conversation model was submitted. - // The time is measured on server side. - google.protobuf.Timestamp create_time = 3; -} - -// Metadata for a [ConversationModels.DeleteConversationModel][google.cloud.dialogflow.v2.ConversationModels.DeleteConversationModel] operation. -message DeleteConversationModelOperationMetadata { - // The resource name of the conversation model. Format: - // `projects//conversationModels/` - string conversation_model = 1; - - // Timestamp when delete conversation model request was created. The time is - // measured on server side. - google.protobuf.Timestamp create_time = 3; -} - -// Metadata for a -// [ConversationModels.CreateConversationModelEvaluation][google.cloud.dialogflow.v2.ConversationModels.CreateConversationModelEvaluation] -// operation. -message CreateConversationModelEvaluationOperationMetadata { - // State of CreateConversationModel operation. - enum State { - // Operation status not specified. - STATE_UNSPECIFIED = 0; - - // The operation is being prepared. - INITIALIZING = 1; - - // The operation is running. - RUNNING = 2; - - // The operation is cancelled. - CANCELLED = 3; - - // The operation has succeeded. - SUCCEEDED = 4; - - // The operation has failed. - FAILED = 5; - } - - // The resource name of the conversation model. Format: - // `projects//locations//conversationModels//evaluations/` - string conversation_model_evaluation = 1; - - // The resource name of the conversation model. Format: - // `projects//locations//conversationModels/` - string conversation_model = 4; - - // State of CreateConversationModel operation. - State state = 2; - - // Timestamp when the request to create conversation model was submitted. The - // time is measured on server side. - google.protobuf.Timestamp create_time = 3; -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_profile.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_profile.proto deleted file mode 100644 index d1a33bb8025..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/conversation_profile.proto +++ /dev/null @@ -1,753 +0,0 @@ -// Copyright 2022 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}" -}; - -// 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"; - } - - // Adds or updates a suggestion feature in a conversation profile. - // If the conversation profile contains the type of suggestion feature for - // the participant role, it will update it. Otherwise it will insert the - // suggestion feature. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: [SetSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata] - // - `response`: [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile] - // - // If a long running operation to add or update suggestion feature - // config for the same conversation profile, participant role and suggestion - // feature type exists, please cancel the existing long running operation - // before sending such request, otherwise the request will be rejected. - rpc SetSuggestionFeatureConfig(SetSuggestionFeatureConfigRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{conversation_profile=projects/*/conversationProfiles/*}:setSuggestionFeatureConfig" - body: "*" - additional_bindings { - post: "/v2/{conversation_profile=projects/*/locations/*/conversationProfiles/*}:setSuggestionFeatureConfig" - body: "*" - } - }; - option (google.api.method_signature) = "conversation_profile"; - option (google.longrunning.operation_info) = { - response_type: "ConversationProfile" - metadata_type: "SetSuggestionFeatureConfigOperationMetadata" - }; - } - - // Clears a suggestion feature from a conversation profile for the given - // participant role. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: [ClearSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata] - // - `response`: [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile] - rpc ClearSuggestionFeatureConfig(ClearSuggestionFeatureConfigRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{conversation_profile=projects/*/conversationProfiles/*}:clearSuggestionFeatureConfig" - body: "*" - additional_bindings { - post: "/v2/{conversation_profile=projects/*/locations/*/conversationProfiles/*}:clearSuggestionFeatureConfig" - body: "*" - } - }; - option (google.api.method_signature) = "conversation_profile"; - option (google.longrunning.operation_info) = { - response_type: "ConversationProfile" - metadata_type: "ClearSuggestionFeatureConfigOperationMetadata" - }; - } -} - -// 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 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. - // This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) - // language tag. Example: "en-US". - string language_code = 10; - - // The time zone of this conversational profile from the - // [time zone database](https://www.iana.org/time-zones), e.g., - // America/New_York, Europe/Paris. Defaults to America/New_York. - string time_zone = 14; - - // Name of the CX SecuritySettings reference for the agent. - // Format: `projects//locations//securitySettings/`. - string security_settings = 13 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/CXSecuritySettings" - }]; -} - -// 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. - // - // - 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.v2#google.cloud.dialogflow.v2.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 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; - - // Configs for processing conversation. - ConversationProcessConfig conversation_process_config = 8; - } - - // 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, 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, - // CONVERSATION_SUMMARIZATION. - message ConversationModelConfig { - // Conversation model resource name. Format: `projects//conversationModels/`. - string model = 1 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/ConversationModel" - }]; - } - - // Config to process conversation. - message ConversationProcessConfig { - // Number of recent non-small-talk sentences to use as context for article - // and FAQ suggestion - int32 recent_sentences_count = 2; - } - - // 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 unspecified, PROTO will be used. - MESSAGE_FORMAT_UNSPECIFIED = 0; - - // Pub/Sub message will be serialized proto. - PROTO = 1; - - // Pub/Sub 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. - // - // For telephony integration to receive notification, make sure either this - // topic 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. - // - // For chat integration to receive notification, make sure API caller has been - // granted the `Dialogflow Service Agent` role for the topic. - // - // 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 for chat. - ARTICLE_SUGGESTION = 1; - - // Run FAQ model for chat. - FAQ = 2; - - // Run smart reply model for chat. - SMART_REPLY = 3; - } - - // Type of Human Agent Assistant API feature to request. - Type type = 1; -} - -// The request message for -// [ConversationProfiles.SetSuggestionFeature][]. -message SetSuggestionFeatureConfigRequest { - // Required. The Conversation Profile to add or update the suggestion feature - // config. Format: `projects//locations//conversationProfiles/`. - string conversation_profile = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The participant role to add or update the suggestion feature - // config. Only HUMAN_AGENT or END_USER can be used. - Participant.Role participant_role = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The suggestion feature config to add or update. - HumanAgentAssistantConfig.SuggestionFeatureConfig suggestion_feature_config = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for [ConversationProfiles.ClearFeature][]. -message ClearSuggestionFeatureConfigRequest { - // Required. The Conversation Profile to add or update the suggestion feature - // config. Format: `projects//locations//conversationProfiles/`. - string conversation_profile = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The participant role to remove the suggestion feature - // config. Only HUMAN_AGENT or END_USER can be used. - Participant.Role participant_role = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The type of the suggestion feature to remove. - SuggestionFeature.Type suggestion_feature_type = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Metadata for a [ConversationProfile.SetSuggestionFeatureConfig][] -// operation. -message SetSuggestionFeatureConfigOperationMetadata { - // The resource name of the conversation profile. Format: - // `projects//locations//conversationProfiles/` - string conversation_profile = 1; - - // Required. The participant role to add or update the suggestion feature - // config. Only HUMAN_AGENT or END_USER can be used. - Participant.Role participant_role = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The type of the suggestion feature to add or update. - SuggestionFeature.Type suggestion_feature_type = 3 [(google.api.field_behavior) = REQUIRED]; - - // Timestamp whe the request was created. The time is measured on server side. - google.protobuf.Timestamp create_time = 4; -} - -// Metadata for a [ConversationProfile.ClearSuggestionFeatureConfig][] -// operation. -message ClearSuggestionFeatureConfigOperationMetadata { - // The resource name of the conversation profile. Format: - // `projects//locations//conversationProfiles/` - string conversation_profile = 1; - - // Required. The participant role to remove the suggestion feature - // config. Only HUMAN_AGENT or END_USER can be used. - Participant.Role participant_role = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The type of the suggestion feature to remove. - SuggestionFeature.Type suggestion_feature_type = 3 [(google.api.field_behavior) = REQUIRED]; - - // Timestamp whe the request was created. The time is measured on server side. - google.protobuf.Timestamp create_time = 4; -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/document.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/document.proto deleted file mode 100644 index 1241621948f..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/document.proto +++ /dev/null @@ -1,636 +0,0 @@ -// Copyright 2022 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/gcs.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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] - // - `response`: [Document][google.cloud.dialogflow.v2.Document] - 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" - }; - } - - // Creates 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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] - // - `response`: [ImportDocumentsResponse][google.cloud.dialogflow.v2.ImportDocumentsResponse] - rpc ImportDocuments(ImportDocumentsRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/knowledgeBases/*}/documents:import" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/knowledgeBases/*}/documents:import" - body: "*" - } - }; - option (google.longrunning.operation_info) = { - response_type: "ImportDocumentsResponse" - metadata_type: "KnowledgeOperationMetadata" - }; - } - - // Deletes the specified document. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] - // - `response`: An [Empty - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - 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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] - // - `response`: [Document][google.cloud.dialogflow.v2.Document] - 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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] - // - `response`: [Document][google.cloud.dialogflow.v2.Document] - // - // 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: "/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" - }; - } - - // Exports a smart messaging candidate document into the specified - // destination. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] - // - `response`: [Document][google.cloud.dialogflow.v2.Document] - rpc ExportDocument(ExportDocumentRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/{name=projects/*/knowledgeBases/*/documents/*}:export" - body: "*" - additional_bindings { - post: "/v2/{name=projects/*/locations/*/knowledgeBases/*/documents/*}:export" - body: "*" - } - }; - 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 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 document contains agent-facing Smart Reply entries. - AGENT_FACING_SMART_REPLY = 4; - } - - // 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; - } - - // Possible states of the document - enum State { - // The document state is unspecified. - STATE_UNSPECIFIED = 0; - - // The document creation is in progress. - CREATING = 1; - - // The document is active and ready to use. - ACTIVE = 2; - - // The document updation is in progress. - UPDATING = 3; - - // The document is reloading. - RELOADING = 4; - - // The document deletion is in progress. - DELETING = 5; - } - - // 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]; - - // Output only. The current state of the document. - State state = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// 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; - - // 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.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.ImportDocuments][google.cloud.dialogflow.v2.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.v2.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.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]; - } - - // Optional. 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 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. When enabled, the reload request is to apply partial update to the smart - // messaging allowlist. - bool smart_messaging_partial_update = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for [Documents.ExportDocument][google.cloud.dialogflow.v2.Documents.ExportDocument]. -message ExportDocumentRequest { - // Required. The name of the document to export. - // Format: `projects//locations//knowledgeBases//documents/`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Document" - } - ]; - - // Required. The destination for the export. - oneof destination { - // Cloud Storage file path to export the document. - GcsDestination gcs_destination = 2; - } - - // When enabled, export the full content of the document including empirical - // probability. - bool export_full_content = 3; - - // When enabled, export the smart messaging allowlist document for partial - // update. - bool smart_messaging_partial_update = 5; -} - -// Metadata related to the Export Data Operations (e.g. ExportDocument). -message ExportOperationMetadata { - // Cloud Storage file path of the exported data. - GcsDestination exported_gcs_destination = 1; -} - -// 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]; - - // The name of the knowledge base interacted with during the operation. - string knowledge_base = 3; - - // Additional metadata for the Knowledge operation. - oneof operation_metadata { - // Metadata for the Export Data Operation such as the destination of export. - ExportOperationMetadata export_operation_metadata = 4; - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/entity_type.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/entity_type.proto deleted file mode 100644 index acb5b94f25e..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/entity_type.proto +++ /dev/null @@ -1,613 +0,0 @@ -// Copyright 2022 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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: An empty [Struct - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - // - `response`: [BatchUpdateEntityTypesResponse][google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse] - // - // 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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: An empty [Struct - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - // - `response`: An [Empty - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - // - // 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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: An empty [Struct - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - // - `response`: An [Empty - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - // - // 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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: An empty [Struct - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - // - `response`: An [Empty - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - // - // 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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: An empty [Struct - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - // - `response`: An [Empty - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - // - // 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}" - }; - - // 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; - } - - // 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]; - } - - // 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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/environment.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/environment.proto deleted file mode 100644 index f368db3ec84..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/environment.proto +++ /dev/null @@ -1,390 +0,0 @@ -// Copyright 2022 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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/fulfillment.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/fulfillment.proto deleted file mode 100644 index b1103fe41c0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/fulfillment.proto +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright 2022 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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/gcs.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/gcs.proto deleted file mode 100644 index 6ac9886df90..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/gcs.proto +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2022 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"; - -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"; - -// Google Cloud Storage location 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 the output. -message GcsDestination { - // The Google Cloud Storage URIs for the output. A URI is of the - // form: - // gs://bucket/object-prefix-or-name - // Whether a prefix or name is used depends on the use case. The requesting - // user must have "write-permission" to the bucket. - string uri = 1; -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto deleted file mode 100644 index 0bae8f6834e..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2022 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"; - -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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/intent.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/intent.proto deleted file mode 100644 index e28e0d312a3..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/intent.proto +++ /dev/null @@ -1,1111 +0,0 @@ -// Copyright 2022 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/context.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/struct.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "IntentProto"; -option java_package = "com.google.cloud.dialogflow.v2"; -option objc_class_prefix = "DF"; - -// 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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: An empty [Struct - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - // - `response`: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2.BatchUpdateIntentsResponse] - // - // 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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: An empty [Struct - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - // - `response`: An [Empty - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - // - // 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 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; - } - - // Represents an example that the agent is trained on. - message TrainingPhrase { - // 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]; - } - - // 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]; - } - - // 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 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; - } - - // 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 { - // Format of response media type. - enum ResponseMediaType { - // Unspecified. - RESPONSE_MEDIA_TYPE_UNSPECIFIED = 0; - - // Response media type is audio. - AUDIO = 1; - } - - // 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; - } - - // 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; - } - - // 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; - } - - // 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]; - - // Output only. - // 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 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // 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; - - // Output only. 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 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// 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]; -} - -// 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; -} - -// This message is a wrapper around a collection of intents. -message IntentBatch { - // A collection of intents. - repeated Intent intents = 1; -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/knowledge_base.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/knowledge_base.proto deleted file mode 100644 index 4f047e2ecde..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/knowledge_base.proto +++ /dev/null @@ -1,262 +0,0 @@ -// Copyright 2022 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; - - // 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.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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/participant.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/participant.proto deleted file mode 100644 index f6b385077de..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/participant.proto +++ /dev/null @@ -1,1005 +0,0 @@ -// Copyright 2022 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/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"; - } - - // Adds a text (chat, for example), or audio (phone recording, for example) - // message from a participant into the conversation. - // Note: This method is only available through the gRPC API (not REST). - // - // The top-level message sent to the client by the server is - // `StreamingAnalyzeContentResponse`. Multiple response messages can be - // returned in order. The first one or more messages contain the - // `recognition_result` field. Each result represents a more complete - // transcript of what the user said. The next message contains the - // `reply_text` field and potentially the `reply_audio` field. The message can - // also contain the `automated_agent_reply` field. - // - // 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 StreamingAnalyzeContent(stream StreamingAnalyzeContentRequest) returns (stream StreamingAnalyzeContentResponse) { - } - - // 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"; - } - - // Gets smart replies for a participant based on specific historical - // messages. - rpc SuggestSmartReplies(SuggestSmartRepliesRequest) returns (SuggestSmartRepliesResponse) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestSmartReplies" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestSmartReplies" - 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]; - - // 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.v2.CreateParticipantRequest.participant] or - // [UpdateParticipantRequest][google.cloud.dialogflow.v2.UpdateParticipantRequest.participant], - // Dialogflow adds the obfuscated user id with the participant. - // - // 2. If you set this field in - // [AnalyzeContent][google.cloud.dialogflow.v2.AnalyzeContentRequest.obfuscated_external_user_id] or - // [StreamingAnalyzeContent][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.obfuscated_external_user_id], - // Dialogflow will update [Participant.obfuscated_external_user_id][google.cloud.dialogflow.v2.Participant.obfuscated_external_user_id]. - // - // Dialogflow returns an error if you try to add a user id for a - // non-[END_USER][google.cloud.dialogflow.v2.Participant.Role.END_USER] participant. - // - // Dialogflow uses this user id for billing and measurement purposes. For - // example, Dialogflow determines whether a user in one conversation returned - // in a later conversation. - // - // 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]; - - // Optional. Key-value filters on the metadata of documents returned by article - // suggestion. If specified, article suggestion only returns suggested - // documents that match all filters in their [Document.metadata][google.cloud.dialogflow.v2.Document.metadata]. Multiple - // values for a metadata key should be concatenated by comma. For example, - // filters to match all documents that have 'US' or 'CA' in their market - // metadata values and 'agent' in their user metadata values will be - // ``` - // documents_metadata_filters { - // key: "market" - // value: "US,CA" - // } - // documents_metadata_filters { - // key: "user" - // value: "agent" - // } - // ``` - map documents_metadata_filters = 8 [(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.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; - - // Parameters for a human assist query. - AssistQueryParameters assist_query_params = 14; - - // Additional parameters to be put into Dialogflow CX session parameters. To - // remove a parameter from the session, clients should explicitly set the - // parameter value to null. - // - // Note: this field should only be used if you are connecting to a Dialogflow - // CX agent. - google.protobuf.Struct cx_parameters = 18; - - // 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]. - // - // Note that any failure of Agent Assist features will not lead to the overall - // failure of an AnalyzeContent API call. Instead, the features will - // fail silently with the error field set in the corresponding - // SuggestionResult. - 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]. - // - // Same as human_agent_suggestion_results, any failure of Agent Assist - // features will not lead to the overall failure of an AnalyzeContent API - // call. Instead, the features will fail silently with the error field set in - // the corresponding SuggestionResult. - repeated SuggestionResult end_user_suggestion_results = 7; - - // Indicates the parameters of DTMF. - DtmfParameters dtmf_parameters = 9; -} - -// The top-level message sent by the client to the -// [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent] method. -// -// Multiple request messages should be sent in order: -// -// 1. The first message must contain -// [participant][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.participant], -// [config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.config] and optionally -// [query_params][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.query_params]. If you want -// to receive an audio response, it should also contain -// [reply_audio_config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.reply_audio_config]. -// The message must not contain -// [input][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.input]. -// -// 2. If [config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.config] in the first message -// was set to [audio_config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.audio_config], -// all subsequent messages must contain -// [input_audio][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.input_audio] to continue -// with Speech recognition. -// However, note that: -// -// * Dialogflow will bill you for the audio so far. -// * Dialogflow discards all Speech recognition results in favor of the -// text input. -// -// 3. If [StreamingAnalyzeContentRequest.config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.config] in the first message was set -// to [StreamingAnalyzeContentRequest.text_config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.text_config], then the second message -// must contain only [input_text][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.input_text]. -// Moreover, you must not send more than two messages. -// -// After you sent all input, you must half-close or abort the request stream. -message StreamingAnalyzeContentRequest { - // 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" - } - ]; - - // The input config. - oneof config { - // Instructs the speech recognizer how to process the speech audio. - InputAudioConfig audio_config = 2; - - // The natural language text to be processed. - InputTextConfig text_config = 3; - } - - // 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 - // StreamingAnalyzeContent. If this configuration is not supplied, speech - // synthesis is disabled. - OutputAudioConfig reply_audio_config = 4; - - // The input. - oneof input { - // The input audio content to be recognized. Must be sent if `audio_config` - // is set in the first message. The complete audio over all streaming - // messages must not exceed 1 minute. - bytes input_audio = 5; - - // The UTF-8 encoded natural language text to be processed. Must be sent if - // `text_config` is set in the first message. Text length must not exceed - // 256 bytes for virtual agent interactions. The `input_text` field can be - // only sent once. - string input_text = 6; - - // The DTMF digits used to invoke intent and fill in parameter value. - // - // This input is ignored if the previous response indicated that DTMF input - // is not accepted. - TelephonyDtmfEvents input_dtmf = 9; - } - - // Parameters for a Dialogflow virtual-agent query. - QueryParameters query_params = 7; - - // Parameters for a human assist query. - AssistQueryParameters assist_query_params = 8; - - // Additional parameters to be put into Dialogflow CX session parameters. To - // remove a parameter from the session, clients should explicitly set the - // parameter value to null. - // - // Note: this field should only be used if you are connecting to a Dialogflow - // CX agent. - google.protobuf.Struct cx_parameters = 13; - - // Enable partial virtual agent responses. If this flag is not enabled, - // response stream still contains only one final response even if some - // `Fulfillment`s in Dialogflow virtual agent have been configured to return - // partial responses. - bool enable_partial_automated_agent_reply = 12; -} - -// The top-level message returned from the `StreamingAnalyzeContent` 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. In virtual agent stage: if `enable_partial_automated_agent_reply` is -// true, the following N (currently 1 <= N <= 4) messages -// contain `automated_agent_reply` and optionally `reply_audio` -// returned by the virtual agent. The first (N-1) -// `automated_agent_reply`s will have `automated_agent_reply_type` set to -// `PARTIAL`. The last `automated_agent_reply` has -// `automated_agent_reply_type` set to `FINAL`. -// If `enable_partial_automated_agent_reply` is not enabled, response stream -// only contains the final reply. -// -// In human assist stage: the following N (N >= 1) messages contain -// `human_agent_suggestion_results`, `end_user_suggestion_results` or -// `message`. -message StreamingAnalyzeContentResponse { - // The result of speech recognition. - StreamingRecognitionResult recognition_result = 1; - - // The output text content. - // This field is set if an automated agent responded with a text for the user. - string reply_text = 2; - - // The audio data bytes encoded as specified in the request. - // This field is set if: - // - // - The `reply_audio_config` field is specified in the request. - // - The automated agent, which this output comes from, responded with audio. - // In such case, the `reply_audio.config` field 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 = 3; - - // 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.StreamingAnalyzeContentResponse.reply_audio] instead. - AutomatedAgentReply automated_agent_reply = 4; - - // Message analyzed by CCAI. - Message message = 6; - - // 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 = 7; - - // 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 = 8; - - // Indicates the parameters of DTMF. - DtmfParameters dtmf_parameters = 10; -} - -// 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" - } - ]; - - // 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.v2.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]; - - // Parameters for a human assist query. - AssistQueryParameters assist_query_params = 4; -} - -// 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" - } - ]; - - // 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]; - - // Parameters for a human assist query. - AssistQueryParameters assist_query_params = 4; -} - -// 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; -} - -// The request message for [Participants.SuggestSmartReplies][google.cloud.dialogflow.v2.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" - }]; - - // 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.v2.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 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The name of the latest conversation message used to compile - // suggestion for. - // - // Format: `projects//locations//conversations//messages/`. - string latest_message = 2 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Message" - }]; - - // Number of messages prior to and including - // [latest_message][google.cloud.dialogflow.v2.SuggestSmartRepliesResponse.latest_message] to compile the - // suggestion. It may be smaller than the - // [SuggestSmartRepliesRequest.context_size][google.cloud.dialogflow.v2.SuggestSmartRepliesRequest.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; - - // The unique identifier of the current Dialogflow CX conversation page. - // Format: `projects//locations//agents//flows//pages/`. - string cx_current_page = 11; -} - -// 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; -} - -// 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 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/AnswerRecord" - }]; -} - -// 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; - - // SuggestSmartRepliesResponse if request is for SMART_REPLY. - SuggestSmartRepliesResponse suggest_smart_replies_response = 4; - } -} - -// Defines the language used in the input text. -message InputTextConfig { - // 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. - string language_code = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// 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; -} - -// Represents the parameters of human assist query. -message AssistQueryParameters { - // Key-value filters on the metadata of documents returned by article - // suggestion. If specified, article suggestion only returns suggested - // documents that match all filters in their [Document.metadata][google.cloud.dialogflow.v2.Document.metadata]. Multiple - // values for a metadata key should be concatenated by comma. For example, - // filters to match all documents that have 'US' or 'CA' in their market - // metadata values and 'agent' in their user metadata values will be - // ``` - // documents_metadata_filters { - // key: "market" - // value: "US,CA" - // } - // documents_metadata_filters { - // key: "user" - // value: "agent" - // } - // ``` - map documents_metadata_filters = 1; -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/session.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/session.proto deleted file mode 100644 index 85119ecc531..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/session.proto +++ /dev/null @@ -1,703 +0,0 @@ -// Copyright 2022 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. - // - // If you might use - // [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) - // or other CCAI products now or in the future, consider using - // [AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] - // instead of `DetectIntent`. `AnalyzeContent` has additional - // functionality for Agent Assist and other CCAI products. - // - // 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). - // - // If you might use - // [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) - // or other CCAI products now or in the future, consider using - // [StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent] - // instead of `StreamingDetectIntent`. `StreamingAnalyzeContent` has - // additional functionality for Agent Assist and other CCAI products. - // - // 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. Text length must not exceed - // 256 character for virtual agent interactions. - 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. For more information, see the [cancel slot filling - // documentation](https://cloud.google.com/dialogflow/es/docs/intents-actions-parameters#cancel). - 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 `StreamingDetectIntentRequest.input_audio` field was -// set, the `recognition_result` field is populated for one -// or more messages. -// See the [StreamingRecognitionResult][google.cloud.dialogflow.v2.StreamingRecognitionResult] message for details -// about the result message sequence. -// -// 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. -// -// While end-user audio is being processed, Dialogflow sends a series of -// results. Each result may contain a `transcript` value. A transcript -// represents a portion of the utterance. While the recognizer is processing -// audio, transcript values may be interim values or finalized values. -// Once a transcript is finalized, the `is_final` value is set to true and -// processing continues for the next transcript. -// -// If `StreamingDetectIntentRequest.query_input.audio_config.single_utterance` -// was true, and the recognizer has completed processing audio, -// the `message_type` value is set to `END_OF_SINGLE_UTTERANCE and the -// following (last) result contains the last finalized transcript. -// -// The complete end-user utterance is determined by concatenating the -// finalized transcript values received for the series of results. -// -// In the following example, single utterance is enabled. In the case where -// single utterance is not enabled, result 7 would not occur. -// -// ``` -// Num | transcript | message_type | is_final -// --- | ----------------------- | ----------------------- | -------- -// 1 | "tube" | TRANSCRIPT | false -// 2 | "to be a" | TRANSCRIPT | false -// 3 | "to be" | TRANSCRIPT | false -// 4 | "to be or not to be" | TRANSCRIPT | true -// 5 | "that's" | TRANSCRIPT | false -// 6 | "that is | TRANSCRIPT | false -// 7 | unset | END_OF_SINGLE_UTTERANCE | unset -// 8 | " that is the question" | TRANSCRIPT | true -// ``` -// -// Concatenating the finalized transcripts with `is_final` set to true, -// the complete utterance becomes "to be or not to be that is the question". -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; -} - -// ============================================================================ -// Auxiliary proto messages. -// -// 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 for virtual agent interactions. - 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. - // - // This field is ignored when used in the context of a - // [WebhookResponse.followup_event_input][google.cloud.dialogflow.v2.WebhookResponse.followup_event_input] field, - // because the language was already defined in the originating detect - // intent request. - 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. See: -// https://cloud.google.com/natural-language/docs/basics#interpreting_sentiment_analysis_values -// for how to interpret the result. -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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/session_entity_type.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/session_entity_type.proto deleted file mode 100644 index 00cceba1cc5..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/session_entity_type.proto +++ /dev/null @@ -1,313 +0,0 @@ -// Copyright 2022 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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/validation_result.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/validation_result.proto deleted file mode 100644 index a4c77a9993f..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/validation_result.proto +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2022 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; - -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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/version.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/version.proto deleted file mode 100644 index 8244c547bd7..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/version.proto +++ /dev/null @@ -1,267 +0,0 @@ -// Copyright 2022 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/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/webhook.proto b/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/webhook.proto deleted file mode 100644 index a672ff7150c..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/protos/google/cloud/dialogflow/v2/webhook.proto +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright 2022 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"; - -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/google-cloud-dialogflow/v2/samples/generated/v2/agents.delete_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.delete_agent.js deleted file mode 100644 index 35a1a41ca4b..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.delete_agent.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_Agents_DeleteAgent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project that the agent to delete is associated with. - * Format: `projects/`. - */ - // const parent = 'abc123' - - // Imports the Dialogflow library - const {AgentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new AgentsClient(); - - async function callDeleteAgent() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await dialogflowClient.deleteAgent(request); - console.log(response); - } - - callDeleteAgent(); - // [END dialogflow_v2_generated_Agents_DeleteAgent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.export_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.export_agent.js deleted file mode 100644 index 576b77437fe..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.export_agent.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, agentUri) { - // [START dialogflow_v2_generated_Agents_ExportAgent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project that the agent to export is associated with. - * Format: `projects/`. - */ - // const parent = 'abc123' - /** - * 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. - * Dialogflow performs a write operation for the Cloud Storage object - * on the caller's behalf, so your request authentication must - * have write permissions for the object. For more information, see - * Dialogflow access - * control (https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). - */ - // const agentUri = 'abc123' - - // Imports the Dialogflow library - const {AgentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new AgentsClient(); - - async function callExportAgent() { - // Construct request - const request = { - parent, - agentUri, - }; - - // Run request - const [operation] = await dialogflowClient.exportAgent(request); - const [response] = await operation.promise(); - console.log(response); - } - - callExportAgent(); - // [END dialogflow_v2_generated_Agents_ExportAgent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.get_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.get_agent.js deleted file mode 100644 index 273222deed8..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.get_agent.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_Agents_GetAgent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project that the agent to fetch is associated with. - * Format: `projects/`. - */ - // const parent = 'abc123' - - // Imports the Dialogflow library - const {AgentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new AgentsClient(); - - async function callGetAgent() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await dialogflowClient.getAgent(request); - console.log(response); - } - - callGetAgent(); - // [END dialogflow_v2_generated_Agents_GetAgent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.get_validation_result.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.get_validation_result.js deleted file mode 100644 index c5ac6dbc83a..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.get_validation_result.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_Agents_GetValidationResult_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project that the agent is associated with. - * Format: `projects/`. - */ - // const parent = 'abc123' - /** - * 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. - */ - // const languageCode = 'abc123' - - // Imports the Dialogflow library - const {AgentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new AgentsClient(); - - async function callGetValidationResult() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await dialogflowClient.getValidationResult(request); - console.log(response); - } - - callGetValidationResult(); - // [END dialogflow_v2_generated_Agents_GetValidationResult_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.import_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.import_agent.js deleted file mode 100644 index 336d133cfd2..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.import_agent.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_Agents_ImportAgent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project that the agent to import is associated with. - * Format: `projects/`. - */ - // const parent = 'abc123' - /** - * The URI to a Google Cloud Storage file containing the agent to import. - * Note: The URI must start with "gs://". - * Dialogflow performs a read operation for the Cloud Storage object - * on the caller's behalf, so your request authentication must - * have read permissions for the object. For more information, see - * Dialogflow access - * control (https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). - */ - // const agentUri = 'abc123' - /** - * Zip compressed raw byte content for agent. - */ - // const agentContent = 'Buffer.from('string')' - - // Imports the Dialogflow library - const {AgentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new AgentsClient(); - - async function callImportAgent() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await dialogflowClient.importAgent(request); - const [response] = await operation.promise(); - console.log(response); - } - - callImportAgent(); - // [END dialogflow_v2_generated_Agents_ImportAgent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.restore_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.restore_agent.js deleted file mode 100644 index 02954f41349..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.restore_agent.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_Agents_RestoreAgent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project that the agent to restore is associated with. - * Format: `projects/`. - */ - // const parent = 'abc123' - /** - * The URI to a Google Cloud Storage file containing the agent to restore. - * Note: The URI must start with "gs://". - * Dialogflow performs a read operation for the Cloud Storage object - * on the caller's behalf, so your request authentication must - * have read permissions for the object. For more information, see - * Dialogflow access - * control (https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). - */ - // const agentUri = 'abc123' - /** - * Zip compressed raw byte content for agent. - */ - // const agentContent = 'Buffer.from('string')' - - // Imports the Dialogflow library - const {AgentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new AgentsClient(); - - async function callRestoreAgent() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await dialogflowClient.restoreAgent(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRestoreAgent(); - // [END dialogflow_v2_generated_Agents_RestoreAgent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.search_agents.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.search_agents.js deleted file mode 100644 index 1daeb2188f6..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.search_agents.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_Agents_SearchAgents_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project to list agents from. - * Format: `projects/`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {AgentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new AgentsClient(); - - async function callSearchAgents() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.searchAgentsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callSearchAgents(); - // [END dialogflow_v2_generated_Agents_SearchAgents_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.set_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.set_agent.js deleted file mode 100644 index 369c74e522d..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.set_agent.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 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'; - -function main(agent) { - // [START dialogflow_v2_generated_Agents_SetAgent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The agent to update. - */ - // const agent = {} - /** - * Optional. The mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {AgentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new AgentsClient(); - - async function callSetAgent() { - // Construct request - const request = { - agent, - }; - - // Run request - const response = await dialogflowClient.setAgent(request); - console.log(response); - } - - callSetAgent(); - // [END dialogflow_v2_generated_Agents_SetAgent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.train_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.train_agent.js deleted file mode 100644 index ebf5cd5d62d..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/agents.train_agent.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_Agents_TrainAgent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project that the agent to train is associated with. - * Format: `projects/`. - */ - // const parent = 'abc123' - - // Imports the Dialogflow library - const {AgentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new AgentsClient(); - - async function callTrainAgent() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await dialogflowClient.trainAgent(request); - const [response] = await operation.promise(); - console.log(response); - } - - callTrainAgent(); - // [END dialogflow_v2_generated_Agents_TrainAgent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/answer_records.list_answer_records.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/answer_records.list_answer_records.js deleted file mode 100644 index fa4bab0a98a..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/answer_records.list_answer_records.js +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_AnswerRecords_ListAnswerRecords_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project to list all answer records for in reverse - * chronological order. Format: `projects//locations/`. - */ - // const parent = 'abc123' - /** - * Optional. Filters to restrict results to specific answer records. - * Marked deprecated as it hasn't been, and isn't currently, supported. - * For more information about filtering, see - * API Filtering (https://aip.dev/160). - */ - // const filter = 'abc123' - /** - * 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. - */ - // const pageSize = 1234 - /** - * 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. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {AnswerRecordsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new AnswerRecordsClient(); - - async function callListAnswerRecords() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listAnswerRecordsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAnswerRecords(); - // [END dialogflow_v2_generated_AnswerRecords_ListAnswerRecords_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/answer_records.update_answer_record.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/answer_records.update_answer_record.js deleted file mode 100644 index 4108c84266d..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/answer_records.update_answer_record.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2022 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'; - -function main(answerRecord, updateMask) { - // [START dialogflow_v2_generated_AnswerRecords_UpdateAnswerRecord_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Answer record to update. - */ - // const answerRecord = {} - /** - * Required. The mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {AnswerRecordsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new AnswerRecordsClient(); - - async function callUpdateAnswerRecord() { - // Construct request - const request = { - answerRecord, - updateMask, - }; - - // Run request - const response = await dialogflowClient.updateAnswerRecord(request); - console.log(response); - } - - callUpdateAnswerRecord(); - // [END dialogflow_v2_generated_AnswerRecords_UpdateAnswerRecord_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.create_context.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.create_context.js deleted file mode 100644 index 13cdb444a00..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.create_context.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, context) { - // [START dialogflow_v2_generated_Contexts_CreateContext_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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. - */ - // const parent = 'abc123' - /** - * Required. The context to create. - */ - // const context = {} - - // Imports the Dialogflow library - const {ContextsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ContextsClient(); - - async function callCreateContext() { - // Construct request - const request = { - parent, - context, - }; - - // Run request - const response = await dialogflowClient.createContext(request); - console.log(response); - } - - callCreateContext(); - // [END dialogflow_v2_generated_Contexts_CreateContext_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.delete_all_contexts.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.delete_all_contexts.js deleted file mode 100644 index 4bbb7d03111..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.delete_all_contexts.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_Contexts_DeleteAllContexts_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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. - */ - // const parent = 'abc123' - - // Imports the Dialogflow library - const {ContextsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ContextsClient(); - - async function callDeleteAllContexts() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await dialogflowClient.deleteAllContexts(request); - console.log(response); - } - - callDeleteAllContexts(); - // [END dialogflow_v2_generated_Contexts_DeleteAllContexts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.delete_context.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.delete_context.js deleted file mode 100644 index 24aca4681ba..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.delete_context.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_Contexts_DeleteContext_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {ContextsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ContextsClient(); - - async function callDeleteContext() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.deleteContext(request); - console.log(response); - } - - callDeleteContext(); - // [END dialogflow_v2_generated_Contexts_DeleteContext_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.get_context.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.get_context.js deleted file mode 100644 index 717f9ec1aee..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.get_context.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_Contexts_GetContext_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {ContextsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ContextsClient(); - - async function callGetContext() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getContext(request); - console.log(response); - } - - callGetContext(); - // [END dialogflow_v2_generated_Contexts_GetContext_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.list_contexts.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.list_contexts.js deleted file mode 100644 index cc5b18618ef..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.list_contexts.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_Contexts_ListContexts_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {ContextsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ContextsClient(); - - async function callListContexts() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listContextsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListContexts(); - // [END dialogflow_v2_generated_Contexts_ListContexts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.update_context.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.update_context.js deleted file mode 100644 index 2cfc4668522..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/contexts.update_context.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 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'; - -function main(context) { - // [START dialogflow_v2_generated_Contexts_UpdateContext_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The context to update. - */ - // const context = {} - /** - * Optional. The mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {ContextsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ContextsClient(); - - async function callUpdateContext() { - // Construct request - const request = { - context, - }; - - // Run request - const response = await dialogflowClient.updateContext(request); - console.log(response); - } - - callUpdateContext(); - // [END dialogflow_v2_generated_Contexts_UpdateContext_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.create_conversation_dataset.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.create_conversation_dataset.js deleted file mode 100644 index eb2c98d3877..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.create_conversation_dataset.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, conversationDataset) { - // [START dialogflow_v2_generated_ConversationDatasets_CreateConversationDataset_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project to create conversation dataset for. Format: - * `projects//locations/` - */ - // const parent = 'abc123' - /** - * Required. The conversation dataset to create. - */ - // const conversationDataset = {} - - // Imports the Dialogflow library - const {ConversationDatasetsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationDatasetsClient(); - - async function callCreateConversationDataset() { - // Construct request - const request = { - parent, - conversationDataset, - }; - - // Run request - const [operation] = await dialogflowClient.createConversationDataset(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateConversationDataset(); - // [END dialogflow_v2_generated_ConversationDatasets_CreateConversationDataset_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.delete_conversation_dataset.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.delete_conversation_dataset.js deleted file mode 100644 index 3c20de247e8..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.delete_conversation_dataset.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_ConversationDatasets_DeleteConversationDataset_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The conversation dataset to delete. Format: - * `projects//locations//conversationDatasets/` - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {ConversationDatasetsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationDatasetsClient(); - - async function callDeleteConversationDataset() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await dialogflowClient.deleteConversationDataset(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteConversationDataset(); - // [END dialogflow_v2_generated_ConversationDatasets_DeleteConversationDataset_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.get_conversation_dataset.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.get_conversation_dataset.js deleted file mode 100644 index 44c6c78537c..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.get_conversation_dataset.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_ConversationDatasets_GetConversationDataset_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The conversation dataset to retrieve. Format: - * `projects//locations//conversationDatasets/` - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {ConversationDatasetsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationDatasetsClient(); - - async function callGetConversationDataset() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getConversationDataset(request); - console.log(response); - } - - callGetConversationDataset(); - // [END dialogflow_v2_generated_ConversationDatasets_GetConversationDataset_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.import_conversation_data.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.import_conversation_data.js deleted file mode 100644 index 6f75c4fa269..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.import_conversation_data.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2022 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'; - -function main(name, inputConfig) { - // [START dialogflow_v2_generated_ConversationDatasets_ImportConversationData_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Dataset resource name. Format: - * `projects//locations//conversationDatasets/` - */ - // const name = 'abc123' - /** - * Required. Configuration describing where to import data from. - */ - // const inputConfig = {} - - // Imports the Dialogflow library - const {ConversationDatasetsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationDatasetsClient(); - - async function callImportConversationData() { - // Construct request - const request = { - name, - inputConfig, - }; - - // Run request - const [operation] = await dialogflowClient.importConversationData(request); - const [response] = await operation.promise(); - console.log(response); - } - - callImportConversationData(); - // [END dialogflow_v2_generated_ConversationDatasets_ImportConversationData_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.list_conversation_datasets.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.list_conversation_datasets.js deleted file mode 100644 index aad091cdac7..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_datasets.list_conversation_datasets.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_ConversationDatasets_ListConversationDatasets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project and location name to list all conversation datasets for. - * Format: `projects//locations/` - */ - // const parent = 'abc123' - /** - * Optional. Maximum number of conversation datasets to return in a single - * page. By default 100 and at most 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {ConversationDatasetsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationDatasetsClient(); - - async function callListConversationDatasets() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listConversationDatasetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListConversationDatasets(); - // [END dialogflow_v2_generated_ConversationDatasets_ListConversationDatasets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.create_conversation_model.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.create_conversation_model.js deleted file mode 100644 index d4b354f244b..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.create_conversation_model.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 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'; - -function main(conversationModel) { - // [START dialogflow_v2_generated_ConversationModels_CreateConversationModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The project to create conversation model for. Format: - * `projects/` - */ - // const parent = 'abc123' - /** - * Required. The conversation model to create. - */ - // const conversationModel = {} - - // Imports the Dialogflow library - const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationModelsClient(); - - async function callCreateConversationModel() { - // Construct request - const request = { - conversationModel, - }; - - // Run request - const [operation] = await dialogflowClient.createConversationModel(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateConversationModel(); - // [END dialogflow_v2_generated_ConversationModels_CreateConversationModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.create_conversation_model_evaluation.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.create_conversation_model_evaluation.js deleted file mode 100644 index b535f38f5d1..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.create_conversation_model_evaluation.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, conversationModelEvaluation) { - // [START dialogflow_v2_generated_ConversationModels_CreateConversationModelEvaluation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The conversation model resource name. Format: - * `projects//locations//conversationModels/` - */ - // const parent = 'abc123' - /** - * Required. The conversation model evaluation to be created. - */ - // const conversationModelEvaluation = {} - - // Imports the Dialogflow library - const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationModelsClient(); - - async function callCreateConversationModelEvaluation() { - // Construct request - const request = { - parent, - conversationModelEvaluation, - }; - - // Run request - const [operation] = await dialogflowClient.createConversationModelEvaluation(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateConversationModelEvaluation(); - // [END dialogflow_v2_generated_ConversationModels_CreateConversationModelEvaluation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.delete_conversation_model.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.delete_conversation_model.js deleted file mode 100644 index c444a87c1d3..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.delete_conversation_model.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_ConversationModels_DeleteConversationModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The conversation model to delete. Format: - * `projects//conversationModels/` - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationModelsClient(); - - async function callDeleteConversationModel() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await dialogflowClient.deleteConversationModel(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteConversationModel(); - // [END dialogflow_v2_generated_ConversationModels_DeleteConversationModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.deploy_conversation_model.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.deploy_conversation_model.js deleted file mode 100644 index 8e9de89b3e6..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.deploy_conversation_model.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_ConversationModels_DeployConversationModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The conversation model to deploy. Format: - * `projects//conversationModels/` - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationModelsClient(); - - async function callDeployConversationModel() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await dialogflowClient.deployConversationModel(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeployConversationModel(); - // [END dialogflow_v2_generated_ConversationModels_DeployConversationModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.get_conversation_model.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.get_conversation_model.js deleted file mode 100644 index ad2f4924465..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.get_conversation_model.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_ConversationModels_GetConversationModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The conversation model to retrieve. Format: - * `projects//conversationModels/` - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationModelsClient(); - - async function callGetConversationModel() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getConversationModel(request); - console.log(response); - } - - callGetConversationModel(); - // [END dialogflow_v2_generated_ConversationModels_GetConversationModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.get_conversation_model_evaluation.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.get_conversation_model_evaluation.js deleted file mode 100644 index c8181e4053d..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.get_conversation_model_evaluation.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_ConversationModels_GetConversationModelEvaluation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The conversation model evaluation resource name. Format: - * `projects//conversationModels//evaluations/` - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationModelsClient(); - - async function callGetConversationModelEvaluation() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getConversationModelEvaluation(request); - console.log(response); - } - - callGetConversationModelEvaluation(); - // [END dialogflow_v2_generated_ConversationModels_GetConversationModelEvaluation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.list_conversation_model_evaluations.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.list_conversation_model_evaluations.js deleted file mode 100644 index 6d550c7ef1b..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.list_conversation_model_evaluations.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_ConversationModels_ListConversationModelEvaluations_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The conversation model resource name. Format: - * `projects//conversationModels/` - */ - // const parent = 'abc123' - /** - * Optional. Maximum number of evaluations to return in a - * single page. By default 100 and at most 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationModelsClient(); - - async function callListConversationModelEvaluations() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listConversationModelEvaluationsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListConversationModelEvaluations(); - // [END dialogflow_v2_generated_ConversationModels_ListConversationModelEvaluations_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.list_conversation_models.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.list_conversation_models.js deleted file mode 100644 index b930d994328..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.list_conversation_models.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_ConversationModels_ListConversationModels_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project to list all conversation models for. - * Format: `projects/` - */ - // const parent = 'abc123' - /** - * Optional. Maximum number of conversation models to return in a single - * page. By default 100 and at most 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationModelsClient(); - - async function callListConversationModels() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listConversationModelsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListConversationModels(); - // [END dialogflow_v2_generated_ConversationModels_ListConversationModels_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.undeploy_conversation_model.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.undeploy_conversation_model.js deleted file mode 100644 index 4b604037364..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_models.undeploy_conversation_model.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_ConversationModels_UndeployConversationModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The conversation model to undeploy. Format: - * `projects//conversationModels/` - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationModelsClient(); - - async function callUndeployConversationModel() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await dialogflowClient.undeployConversationModel(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUndeployConversationModel(); - // [END dialogflow_v2_generated_ConversationModels_UndeployConversationModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.clear_suggestion_feature_config.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.clear_suggestion_feature_config.js deleted file mode 100644 index 1f96e6101ce..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.clear_suggestion_feature_config.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2022 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'; - -function main(conversationProfile, participantRole, suggestionFeatureType) { - // [START dialogflow_v2_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Conversation Profile to add or update the suggestion feature - * config. Format: `projects//locations//conversationProfiles/`. - */ - // const conversationProfile = 'abc123' - /** - * Required. The participant role to remove the suggestion feature - * config. Only HUMAN_AGENT or END_USER can be used. - */ - // const participantRole = {} - /** - * Required. The type of the suggestion feature to remove. - */ - // const suggestionFeatureType = {} - - // Imports the Dialogflow library - const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationProfilesClient(); - - async function callClearSuggestionFeatureConfig() { - // Construct request - const request = { - conversationProfile, - participantRole, - suggestionFeatureType, - }; - - // Run request - const [operation] = await dialogflowClient.clearSuggestionFeatureConfig(request); - const [response] = await operation.promise(); - console.log(response); - } - - callClearSuggestionFeatureConfig(); - // [END dialogflow_v2_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.create_conversation_profile.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.create_conversation_profile.js deleted file mode 100644 index 06c37b6fd9e..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.create_conversation_profile.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, conversationProfile) { - // [START dialogflow_v2_generated_ConversationProfiles_CreateConversationProfile_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project to create a conversation profile for. - * Format: `projects//locations/`. - */ - // const parent = 'abc123' - /** - * Required. The conversation profile to create. - */ - // const conversationProfile = {} - - // Imports the Dialogflow library - const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationProfilesClient(); - - async function callCreateConversationProfile() { - // Construct request - const request = { - parent, - conversationProfile, - }; - - // Run request - const response = await dialogflowClient.createConversationProfile(request); - console.log(response); - } - - callCreateConversationProfile(); - // [END dialogflow_v2_generated_ConversationProfiles_CreateConversationProfile_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.delete_conversation_profile.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.delete_conversation_profile.js deleted file mode 100644 index 4dca2d27888..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.delete_conversation_profile.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_ConversationProfiles_DeleteConversationProfile_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the conversation profile to delete. - * Format: `projects//locations//conversationProfiles/`. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationProfilesClient(); - - async function callDeleteConversationProfile() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.deleteConversationProfile(request); - console.log(response); - } - - callDeleteConversationProfile(); - // [END dialogflow_v2_generated_ConversationProfiles_DeleteConversationProfile_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.get_conversation_profile.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.get_conversation_profile.js deleted file mode 100644 index e4cd2c91e96..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.get_conversation_profile.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_ConversationProfiles_GetConversationProfile_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the conversation profile. - * Format: `projects//locations//conversationProfiles/`. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationProfilesClient(); - - async function callGetConversationProfile() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getConversationProfile(request); - console.log(response); - } - - callGetConversationProfile(); - // [END dialogflow_v2_generated_ConversationProfiles_GetConversationProfile_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.list_conversation_profiles.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.list_conversation_profiles.js deleted file mode 100644 index a25e61e3fc8..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.list_conversation_profiles.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_ConversationProfiles_ListConversationProfiles_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project to list all conversation profiles from. - * Format: `projects//locations/`. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return in a single page. By - * default 100 and at most 1000. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationProfilesClient(); - - async function callListConversationProfiles() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listConversationProfilesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListConversationProfiles(); - // [END dialogflow_v2_generated_ConversationProfiles_ListConversationProfiles_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.set_suggestion_feature_config.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.set_suggestion_feature_config.js deleted file mode 100644 index 767750ae2ff..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.set_suggestion_feature_config.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2022 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'; - -function main(conversationProfile, participantRole, suggestionFeatureConfig) { - // [START dialogflow_v2_generated_ConversationProfiles_SetSuggestionFeatureConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Conversation Profile to add or update the suggestion feature - * config. Format: `projects//locations//conversationProfiles/`. - */ - // const conversationProfile = 'abc123' - /** - * Required. The participant role to add or update the suggestion feature - * config. Only HUMAN_AGENT or END_USER can be used. - */ - // const participantRole = {} - /** - * Required. The suggestion feature config to add or update. - */ - // const suggestionFeatureConfig = {} - - // Imports the Dialogflow library - const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationProfilesClient(); - - async function callSetSuggestionFeatureConfig() { - // Construct request - const request = { - conversationProfile, - participantRole, - suggestionFeatureConfig, - }; - - // Run request - const [operation] = await dialogflowClient.setSuggestionFeatureConfig(request); - const [response] = await operation.promise(); - console.log(response); - } - - callSetSuggestionFeatureConfig(); - // [END dialogflow_v2_generated_ConversationProfiles_SetSuggestionFeatureConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.update_conversation_profile.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.update_conversation_profile.js deleted file mode 100644 index 1a6a41ab264..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversation_profiles.update_conversation_profile.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2022 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'; - -function main(conversationProfile, updateMask) { - // [START dialogflow_v2_generated_ConversationProfiles_UpdateConversationProfile_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The conversation profile to update. - */ - // const conversationProfile = {} - /** - * Required. The mask to control which fields to update. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationProfilesClient(); - - async function callUpdateConversationProfile() { - // Construct request - const request = { - conversationProfile, - updateMask, - }; - - // Run request - const response = await dialogflowClient.updateConversationProfile(request); - console.log(response); - } - - callUpdateConversationProfile(); - // [END dialogflow_v2_generated_ConversationProfiles_UpdateConversationProfile_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.complete_conversation.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.complete_conversation.js deleted file mode 100644 index a1f2f129c46..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.complete_conversation.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_Conversations_CompleteConversation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource identifier of the conversation to close. - * Format: `projects//locations//conversations/`. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {ConversationsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationsClient(); - - async function callCompleteConversation() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.completeConversation(request); - console.log(response); - } - - callCompleteConversation(); - // [END dialogflow_v2_generated_Conversations_CompleteConversation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.create_conversation.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.create_conversation.js deleted file mode 100644 index 390d99d9131..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.create_conversation.js +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, conversation) { - // [START dialogflow_v2_generated_Conversations_CreateConversation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource identifier of the project creating the conversation. - * Format: `projects//locations/`. - */ - // const parent = 'abc123' - /** - * Required. The conversation to create. - */ - // const conversation = {} - /** - * 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. - */ - // const conversationId = 'abc123' - - // Imports the Dialogflow library - const {ConversationsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationsClient(); - - async function callCreateConversation() { - // Construct request - const request = { - parent, - conversation, - }; - - // Run request - const response = await dialogflowClient.createConversation(request); - console.log(response); - } - - callCreateConversation(); - // [END dialogflow_v2_generated_Conversations_CreateConversation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.get_conversation.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.get_conversation.js deleted file mode 100644 index a75dbd80632..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.get_conversation.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_Conversations_GetConversation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the conversation. Format: - * `projects//locations//conversations/`. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {ConversationsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationsClient(); - - async function callGetConversation() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getConversation(request); - console.log(response); - } - - callGetConversation(); - // [END dialogflow_v2_generated_Conversations_GetConversation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.list_conversations.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.list_conversations.js deleted file mode 100644 index 23328a9beb7..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.list_conversations.js +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_Conversations_ListConversations_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project from which to list all conversation. - * Format: `projects//locations/`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - /** - * 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). - */ - // const filter = 'abc123' - - // Imports the Dialogflow library - const {ConversationsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationsClient(); - - async function callListConversations() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listConversationsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListConversations(); - // [END dialogflow_v2_generated_Conversations_ListConversations_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.list_messages.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.list_messages.js deleted file mode 100644 index dc87405de1f..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/conversations.list_messages.js +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_Conversations_ListMessages_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the conversation to list messages for. - * Format: `projects//locations//conversations/` - */ - // const parent = 'abc123' - /** - * 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). - */ - // const filter = 'abc123' - /** - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {ConversationsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ConversationsClient(); - - async function callListMessages() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listMessagesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListMessages(); - // [END dialogflow_v2_generated_Conversations_ListMessages_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.create_document.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.create_document.js deleted file mode 100644 index 7a59f4c0126..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.create_document.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, document) { - // [START dialogflow_v2_generated_Documents_CreateDocument_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The knowledge base to create a document for. - * Format: `projects//locations//knowledgeBases/`. - */ - // const parent = 'abc123' - /** - * Required. The document to create. - */ - // const document = {} - - // Imports the Dialogflow library - const {DocumentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new DocumentsClient(); - - async function callCreateDocument() { - // Construct request - const request = { - parent, - document, - }; - - // Run request - const [operation] = await dialogflowClient.createDocument(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateDocument(); - // [END dialogflow_v2_generated_Documents_CreateDocument_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.delete_document.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.delete_document.js deleted file mode 100644 index 962a21c8e37..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.delete_document.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_Documents_DeleteDocument_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the document to delete. - * Format: `projects//locations//knowledgeBases//documents/`. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {DocumentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new DocumentsClient(); - - async function callDeleteDocument() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await dialogflowClient.deleteDocument(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteDocument(); - // [END dialogflow_v2_generated_Documents_DeleteDocument_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.export_document.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.export_document.js deleted file mode 100644 index cae64ba4f17..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.export_document.js +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_Documents_ExportDocument_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the document to export. - * Format: `projects//locations//knowledgeBases//documents/`. - */ - // const name = 'abc123' - /** - * Cloud Storage file path to export the document. - */ - // const gcsDestination = {} - /** - * When enabled, export the full content of the document including empirical - * probability. - */ - // const exportFullContent = true - /** - * When enabled, export the smart messaging allowlist document for partial - * update. - */ - // const smartMessagingPartialUpdate = true - - // Imports the Dialogflow library - const {DocumentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new DocumentsClient(); - - async function callExportDocument() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await dialogflowClient.exportDocument(request); - const [response] = await operation.promise(); - console.log(response); - } - - callExportDocument(); - // [END dialogflow_v2_generated_Documents_ExportDocument_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.get_document.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.get_document.js deleted file mode 100644 index 9fce9ffc540..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.get_document.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_Documents_GetDocument_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the document to retrieve. - * Format `projects//locations//knowledgeBases//documents/`. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {DocumentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new DocumentsClient(); - - async function callGetDocument() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getDocument(request); - console.log(response); - } - - callGetDocument(); - // [END dialogflow_v2_generated_Documents_GetDocument_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.import_documents.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.import_documents.js deleted file mode 100644 index 7861311d1ec..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.import_documents.js +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, documentTemplate) { - // [START dialogflow_v2_generated_Documents_ImportDocuments_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The knowledge base to import documents into. - * Format: `projects//locations//knowledgeBases/`. - */ - // const parent = 'abc123' - /** - * The Google Cloud Storage location for the documents. - * The path can include a wildcard. - * These URIs may have the forms - * `gs:///`. - * `gs:////*.`. - */ - // const gcsSource = {} - /** - * Required. Document template used for importing all the documents. - */ - // const documentTemplate = {} - /** - * Whether to import custom metadata from Google Cloud Storage. - * Only valid when the document source is Google Cloud Storage URI. - */ - // const importGcsCustomMetadata = true - - // Imports the Dialogflow library - const {DocumentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new DocumentsClient(); - - async function callImportDocuments() { - // Construct request - const request = { - parent, - documentTemplate, - }; - - // Run request - const [operation] = await dialogflowClient.importDocuments(request); - const [response] = await operation.promise(); - console.log(response); - } - - callImportDocuments(); - // [END dialogflow_v2_generated_Documents_ImportDocuments_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.list_documents.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.list_documents.js deleted file mode 100644 index 795b3ea3439..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.list_documents.js +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_Documents_ListDocuments_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The knowledge base to list all documents for. - * Format: `projects//locations//knowledgeBases/`. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return in a single page. By - * default 10 and at most 100. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - /** - * 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). - */ - // const filter = 'abc123' - - // Imports the Dialogflow library - const {DocumentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new DocumentsClient(); - - async function callListDocuments() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listDocumentsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListDocuments(); - // [END dialogflow_v2_generated_Documents_ListDocuments_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.reload_document.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.reload_document.js deleted file mode 100644 index c5b6c1b9745..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.reload_document.js +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_Documents_ReloadDocument_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the document to reload. - * Format: `projects//locations//knowledgeBases//documents/` - */ - // const name = 'abc123' - /** - * 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:///`. - */ - // const contentUri = 'abc123' - /** - * Optional. Whether to import custom metadata from Google Cloud Storage. - * Only valid when the document source is Google Cloud Storage URI. - */ - // const importGcsCustomMetadata = true - /** - * Optional. When enabled, the reload request is to apply partial update to the smart - * messaging allowlist. - */ - // const smartMessagingPartialUpdate = true - - // Imports the Dialogflow library - const {DocumentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new DocumentsClient(); - - async function callReloadDocument() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await dialogflowClient.reloadDocument(request); - const [response] = await operation.promise(); - console.log(response); - } - - callReloadDocument(); - // [END dialogflow_v2_generated_Documents_ReloadDocument_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.update_document.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.update_document.js deleted file mode 100644 index 56f44cd204f..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/documents.update_document.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2022 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'; - -function main(document) { - // [START dialogflow_v2_generated_Documents_UpdateDocument_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The document to update. - */ - // const document = {} - /** - * Optional. Not specified means `update all`. - * Currently, only `display_name` can be updated, an InvalidArgument will be - * returned for attempting to update other fields. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {DocumentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new DocumentsClient(); - - async function callUpdateDocument() { - // Construct request - const request = { - document, - }; - - // Run request - const [operation] = await dialogflowClient.updateDocument(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateDocument(); - // [END dialogflow_v2_generated_Documents_UpdateDocument_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_create_entities.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_create_entities.js deleted file mode 100644 index 0af48b2d653..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_create_entities.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, entities) { - // [START dialogflow_v2_generated_EntityTypes_BatchCreateEntities_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the entity type to create entities in. Format: - * `projects//agent/entityTypes/`. - */ - // const parent = 'abc123' - /** - * Required. The entities to create. - */ - // const entities = 1234 - /** - * 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). - */ - // const languageCode = 'abc123' - - // Imports the Dialogflow library - const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new EntityTypesClient(); - - async function callBatchCreateEntities() { - // Construct request - const request = { - parent, - entities, - }; - - // Run request - const [operation] = await dialogflowClient.batchCreateEntities(request); - const [response] = await operation.promise(); - console.log(response); - } - - callBatchCreateEntities(); - // [END dialogflow_v2_generated_EntityTypes_BatchCreateEntities_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_delete_entities.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_delete_entities.js deleted file mode 100644 index f84f2922bfa..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_delete_entities.js +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, entityValues) { - // [START dialogflow_v2_generated_EntityTypes_BatchDeleteEntities_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the entity type to delete entries for. Format: - * `projects//agent/entityTypes/`. - */ - // const parent = 'abc123' - /** - * 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/`. - */ - // const entityValues = 'abc123' - /** - * 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). - */ - // const languageCode = 'abc123' - - // Imports the Dialogflow library - const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new EntityTypesClient(); - - async function callBatchDeleteEntities() { - // Construct request - const request = { - parent, - entityValues, - }; - - // Run request - const [operation] = await dialogflowClient.batchDeleteEntities(request); - const [response] = await operation.promise(); - console.log(response); - } - - callBatchDeleteEntities(); - // [END dialogflow_v2_generated_EntityTypes_BatchDeleteEntities_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_delete_entity_types.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_delete_entity_types.js deleted file mode 100644 index 1b1e6839e6b..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_delete_entity_types.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, entityTypeNames) { - // [START dialogflow_v2_generated_EntityTypes_BatchDeleteEntityTypes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the agent to delete all entities types for. Format: - * `projects//agent`. - */ - // const parent = 'abc123' - /** - * Required. The names entity types to delete. All names must point to the - * same agent as `parent`. - */ - // const entityTypeNames = 'abc123' - - // Imports the Dialogflow library - const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new EntityTypesClient(); - - async function callBatchDeleteEntityTypes() { - // Construct request - const request = { - parent, - entityTypeNames, - }; - - // Run request - const [operation] = await dialogflowClient.batchDeleteEntityTypes(request); - const [response] = await operation.promise(); - console.log(response); - } - - callBatchDeleteEntityTypes(); - // [END dialogflow_v2_generated_EntityTypes_BatchDeleteEntityTypes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_update_entities.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_update_entities.js deleted file mode 100644 index 6b914ec3043..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_update_entities.js +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, entities) { - // [START dialogflow_v2_generated_EntityTypes_BatchUpdateEntities_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the entity type to update or create entities in. - * Format: `projects//agent/entityTypes/`. - */ - // const parent = 'abc123' - /** - * Required. The entities to update or create. - */ - // const entities = 1234 - /** - * 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). - */ - // const languageCode = 'abc123' - /** - * Optional. The mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new EntityTypesClient(); - - async function callBatchUpdateEntities() { - // Construct request - const request = { - parent, - entities, - }; - - // Run request - const [operation] = await dialogflowClient.batchUpdateEntities(request); - const [response] = await operation.promise(); - console.log(response); - } - - callBatchUpdateEntities(); - // [END dialogflow_v2_generated_EntityTypes_BatchUpdateEntities_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_update_entity_types.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_update_entity_types.js deleted file mode 100644 index c2a1ed41d4b..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.batch_update_entity_types.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_EntityTypes_BatchUpdateEntityTypes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the agent to update or create entity types in. - * Format: `projects//agent`. - */ - // const parent = 'abc123' - /** - * 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://". - */ - // const entityTypeBatchUri = 'abc123' - /** - * The collection of entity types to update or create. - */ - // const entityTypeBatchInline = {} - /** - * 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). - */ - // const languageCode = 'abc123' - /** - * Optional. The mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new EntityTypesClient(); - - async function callBatchUpdateEntityTypes() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await dialogflowClient.batchUpdateEntityTypes(request); - const [response] = await operation.promise(); - console.log(response); - } - - callBatchUpdateEntityTypes(); - // [END dialogflow_v2_generated_EntityTypes_BatchUpdateEntityTypes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.create_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.create_entity_type.js deleted file mode 100644 index 45bca5bf77f..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.create_entity_type.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, entityType) { - // [START dialogflow_v2_generated_EntityTypes_CreateEntityType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The agent to create a entity type for. - * Format: `projects//agent`. - */ - // const parent = 'abc123' - /** - * Required. The entity type to create. - */ - // const 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). - */ - // const languageCode = 'abc123' - - // Imports the Dialogflow library - const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new EntityTypesClient(); - - async function callCreateEntityType() { - // Construct request - const request = { - parent, - entityType, - }; - - // Run request - const response = await dialogflowClient.createEntityType(request); - console.log(response); - } - - callCreateEntityType(); - // [END dialogflow_v2_generated_EntityTypes_CreateEntityType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.delete_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.delete_entity_type.js deleted file mode 100644 index 03c20e526bb..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.delete_entity_type.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_EntityTypes_DeleteEntityType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the entity type to delete. - * Format: `projects//agent/entityTypes/`. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new EntityTypesClient(); - - async function callDeleteEntityType() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.deleteEntityType(request); - console.log(response); - } - - callDeleteEntityType(); - // [END dialogflow_v2_generated_EntityTypes_DeleteEntityType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.get_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.get_entity_type.js deleted file mode 100644 index 9ce87aff18a..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.get_entity_type.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_EntityTypes_GetEntityType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the entity type. - * Format: `projects//agent/entityTypes/`. - */ - // const name = 'abc123' - /** - * 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). - */ - // const languageCode = 'abc123' - - // Imports the Dialogflow library - const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new EntityTypesClient(); - - async function callGetEntityType() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getEntityType(request); - console.log(response); - } - - callGetEntityType(); - // [END dialogflow_v2_generated_EntityTypes_GetEntityType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.list_entity_types.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.list_entity_types.js deleted file mode 100644 index e5d3abb8854..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.list_entity_types.js +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_EntityTypes_ListEntityTypes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The agent to list all entity types from. - * Format: `projects//agent`. - */ - // const parent = 'abc123' - /** - * 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). - */ - // const languageCode = 'abc123' - /** - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new EntityTypesClient(); - - async function callListEntityTypes() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listEntityTypesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListEntityTypes(); - // [END dialogflow_v2_generated_EntityTypes_ListEntityTypes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.update_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.update_entity_type.js deleted file mode 100644 index 9522c7521f6..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/entity_types.update_entity_type.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 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'; - -function main(entityType) { - // [START dialogflow_v2_generated_EntityTypes_UpdateEntityType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The entity type to update. - */ - // const 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). - */ - // const languageCode = 'abc123' - /** - * Optional. The mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new EntityTypesClient(); - - async function callUpdateEntityType() { - // Construct request - const request = { - entityType, - }; - - // Run request - const response = await dialogflowClient.updateEntityType(request); - console.log(response); - } - - callUpdateEntityType(); - // [END dialogflow_v2_generated_EntityTypes_UpdateEntityType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.create_environment.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.create_environment.js deleted file mode 100644 index 0139e135542..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.create_environment.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, environment, environmentId) { - // [START dialogflow_v2_generated_Environments_CreateEnvironment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The agent to create an environment for. - * Supported formats: - * - `projects//agent` - * - `projects//locations//agent` - */ - // const parent = 'abc123' - /** - * Required. The environment to create. - */ - // const environment = {} - /** - * Required. The unique id of the new environment. - */ - // const environmentId = 'abc123' - - // Imports the Dialogflow library - const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new EnvironmentsClient(); - - async function callCreateEnvironment() { - // Construct request - const request = { - parent, - environment, - environmentId, - }; - - // Run request - const response = await dialogflowClient.createEnvironment(request); - console.log(response); - } - - callCreateEnvironment(); - // [END dialogflow_v2_generated_Environments_CreateEnvironment_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.delete_environment.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.delete_environment.js deleted file mode 100644 index a13c799a0a5..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.delete_environment.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_Environments_DeleteEnvironment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the environment to delete. - * / Format: - * - `projects//agent/environments/` - * - `projects//locations//agent/environments/` - * The environment ID for the default environment is `-`. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new EnvironmentsClient(); - - async function callDeleteEnvironment() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.deleteEnvironment(request); - console.log(response); - } - - callDeleteEnvironment(); - // [END dialogflow_v2_generated_Environments_DeleteEnvironment_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.get_environment.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.get_environment.js deleted file mode 100644 index f1dd9fbe7c1..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.get_environment.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_Environments_GetEnvironment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the environment. - * Supported formats: - * - `projects//agent/environments/` - * - `projects//locations//agent/environments/` - * The environment ID for the default environment is `-`. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new EnvironmentsClient(); - - async function callGetEnvironment() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getEnvironment(request); - console.log(response); - } - - callGetEnvironment(); - // [END dialogflow_v2_generated_Environments_GetEnvironment_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.get_environment_history.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.get_environment_history.js deleted file mode 100644 index 7efbf8c312c..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.get_environment_history.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_Environments_GetEnvironmentHistory_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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 `-`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of items to return in a single page. By default 100 and - * at most 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new EnvironmentsClient(); - - async function callGetEnvironmentHistory() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.getEnvironmentHistoryAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callGetEnvironmentHistory(); - // [END dialogflow_v2_generated_Environments_GetEnvironmentHistory_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.list_environments.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.list_environments.js deleted file mode 100644 index 232d265b7c5..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.list_environments.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_Environments_ListEnvironments_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The agent to list all environments from. - * Format: - * - `projects//agent` - * - `projects//locations//agent` - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of items to return in a single page. By default 100 and - * at most 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new EnvironmentsClient(); - - async function callListEnvironments() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listEnvironmentsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListEnvironments(); - // [END dialogflow_v2_generated_Environments_ListEnvironments_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.update_environment.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.update_environment.js deleted file mode 100644 index 5a3a190371f..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/environments.update_environment.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 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'; - -function main(environment, updateMask) { - // [START dialogflow_v2_generated_Environments_UpdateEnvironment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The environment to update. - */ - // const environment = {} - /** - * Required. The mask to control which fields get updated. - */ - // const updateMask = {} - /** - * 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 = `-`). - */ - // const allowLoadToDraftAndDiscardChanges = true - - // Imports the Dialogflow library - const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new EnvironmentsClient(); - - async function callUpdateEnvironment() { - // Construct request - const request = { - environment, - updateMask, - }; - - // Run request - const response = await dialogflowClient.updateEnvironment(request); - console.log(response); - } - - callUpdateEnvironment(); - // [END dialogflow_v2_generated_Environments_UpdateEnvironment_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/fulfillments.get_fulfillment.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/fulfillments.get_fulfillment.js deleted file mode 100644 index 97b59e7c0df..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/fulfillments.get_fulfillment.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_Fulfillments_GetFulfillment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the fulfillment. - * Format: `projects//agent/fulfillment`. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {FulfillmentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new FulfillmentsClient(); - - async function callGetFulfillment() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getFulfillment(request); - console.log(response); - } - - callGetFulfillment(); - // [END dialogflow_v2_generated_Fulfillments_GetFulfillment_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/fulfillments.update_fulfillment.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/fulfillments.update_fulfillment.js deleted file mode 100644 index 2eaa4eaf921..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/fulfillments.update_fulfillment.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 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'; - -function main(fulfillment, updateMask) { - // [START dialogflow_v2_generated_Fulfillments_UpdateFulfillment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The fulfillment to update. - */ - // const fulfillment = {} - /** - * Required. The mask to control which fields get updated. If the mask is not - * present, all fields will be updated. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {FulfillmentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new FulfillmentsClient(); - - async function callUpdateFulfillment() { - // Construct request - const request = { - fulfillment, - updateMask, - }; - - // Run request - const response = await dialogflowClient.updateFulfillment(request); - console.log(response); - } - - callUpdateFulfillment(); - // [END dialogflow_v2_generated_Fulfillments_UpdateFulfillment_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.batch_delete_intents.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.batch_delete_intents.js deleted file mode 100644 index d383fb9171c..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.batch_delete_intents.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, intents) { - // [START dialogflow_v2_generated_Intents_BatchDeleteIntents_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the agent to delete all entities types for. Format: - * `projects//agent`. - */ - // const parent = 'abc123' - /** - * Required. The collection of intents to delete. Only intent `name` must be - * filled in. - */ - // const intents = 1234 - - // Imports the Dialogflow library - const {IntentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new IntentsClient(); - - async function callBatchDeleteIntents() { - // Construct request - const request = { - parent, - intents, - }; - - // Run request - const [operation] = await dialogflowClient.batchDeleteIntents(request); - const [response] = await operation.promise(); - console.log(response); - } - - callBatchDeleteIntents(); - // [END dialogflow_v2_generated_Intents_BatchDeleteIntents_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.batch_update_intents.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.batch_update_intents.js deleted file mode 100644 index 95c585f6d99..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.batch_update_intents.js +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_Intents_BatchUpdateIntents_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the agent to update or create intents in. - * Format: `projects//agent`. - */ - // const parent = 'abc123' - /** - * 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://". - */ - // const intentBatchUri = 'abc123' - /** - * The collection of intents to update or create. - */ - // const intentBatchInline = {} - /** - * 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). - */ - // const languageCode = 'abc123' - /** - * Optional. The mask to control which fields get updated. - */ - // const updateMask = {} - /** - * Optional. The resource view to apply to the returned intent. - */ - // const intentView = {} - - // Imports the Dialogflow library - const {IntentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new IntentsClient(); - - async function callBatchUpdateIntents() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await dialogflowClient.batchUpdateIntents(request); - const [response] = await operation.promise(); - console.log(response); - } - - callBatchUpdateIntents(); - // [END dialogflow_v2_generated_Intents_BatchUpdateIntents_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.create_intent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.create_intent.js deleted file mode 100644 index 67f3789c77b..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.create_intent.js +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, intent) { - // [START dialogflow_v2_generated_Intents_CreateIntent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The agent to create a intent for. - * Format: `projects//agent`. - */ - // const parent = 'abc123' - /** - * Required. The intent to create. - */ - // const 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). - */ - // const languageCode = 'abc123' - /** - * Optional. The resource view to apply to the returned intent. - */ - // const intentView = {} - - // Imports the Dialogflow library - const {IntentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new IntentsClient(); - - async function callCreateIntent() { - // Construct request - const request = { - parent, - intent, - }; - - // Run request - const response = await dialogflowClient.createIntent(request); - console.log(response); - } - - callCreateIntent(); - // [END dialogflow_v2_generated_Intents_CreateIntent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.delete_intent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.delete_intent.js deleted file mode 100644 index f38f93dd1fc..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.delete_intent.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_Intents_DeleteIntent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the intent to delete. If this intent has direct or - * indirect followup intents, we also delete them. - * Format: `projects//agent/intents/`. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {IntentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new IntentsClient(); - - async function callDeleteIntent() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.deleteIntent(request); - console.log(response); - } - - callDeleteIntent(); - // [END dialogflow_v2_generated_Intents_DeleteIntent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.get_intent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.get_intent.js deleted file mode 100644 index 9031c7a23fe..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.get_intent.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_Intents_GetIntent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the intent. - * Format: `projects//agent/intents/`. - */ - // const name = 'abc123' - /** - * 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). - */ - // const languageCode = 'abc123' - /** - * Optional. The resource view to apply to the returned intent. - */ - // const intentView = {} - - // Imports the Dialogflow library - const {IntentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new IntentsClient(); - - async function callGetIntent() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getIntent(request); - console.log(response); - } - - callGetIntent(); - // [END dialogflow_v2_generated_Intents_GetIntent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.list_intents.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.list_intents.js deleted file mode 100644 index 0868e386d58..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.list_intents.js +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_Intents_ListIntents_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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. - */ - // const parent = 'abc123' - /** - * 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). - */ - // const languageCode = 'abc123' - /** - * Optional. The resource view to apply to the returned intent. - */ - // const intentView = {} - /** - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {IntentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new IntentsClient(); - - async function callListIntents() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listIntentsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListIntents(); - // [END dialogflow_v2_generated_Intents_ListIntents_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.update_intent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.update_intent.js deleted file mode 100644 index 0cd8227a6a8..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/intents.update_intent.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2022 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'; - -function main(intent) { - // [START dialogflow_v2_generated_Intents_UpdateIntent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The intent to update. - */ - // const 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). - */ - // const languageCode = 'abc123' - /** - * Optional. The mask to control which fields get updated. - */ - // const updateMask = {} - /** - * Optional. The resource view to apply to the returned intent. - */ - // const intentView = {} - - // Imports the Dialogflow library - const {IntentsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new IntentsClient(); - - async function callUpdateIntent() { - // Construct request - const request = { - intent, - }; - - // Run request - const response = await dialogflowClient.updateIntent(request); - console.log(response); - } - - callUpdateIntent(); - // [END dialogflow_v2_generated_Intents_UpdateIntent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.create_knowledge_base.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.create_knowledge_base.js deleted file mode 100644 index 0f699b2799d..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.create_knowledge_base.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, knowledgeBase) { - // [START dialogflow_v2_generated_KnowledgeBases_CreateKnowledgeBase_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project to create a knowledge base for. - * Format: `projects//locations/`. - */ - // const parent = 'abc123' - /** - * Required. The knowledge base to create. - */ - // const knowledgeBase = {} - - // Imports the Dialogflow library - const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new KnowledgeBasesClient(); - - async function callCreateKnowledgeBase() { - // Construct request - const request = { - parent, - knowledgeBase, - }; - - // Run request - const response = await dialogflowClient.createKnowledgeBase(request); - console.log(response); - } - - callCreateKnowledgeBase(); - // [END dialogflow_v2_generated_KnowledgeBases_CreateKnowledgeBase_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.delete_knowledge_base.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.delete_knowledge_base.js deleted file mode 100644 index 35e6176174b..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.delete_knowledge_base.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_KnowledgeBases_DeleteKnowledgeBase_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the knowledge base to delete. - * Format: `projects//locations//knowledgeBases/`. - */ - // const name = 'abc123' - /** - * Optional. Force deletes the knowledge base. When set to true, any documents - * in the knowledge base are also deleted. - */ - // const force = true - - // Imports the Dialogflow library - const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new KnowledgeBasesClient(); - - async function callDeleteKnowledgeBase() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.deleteKnowledgeBase(request); - console.log(response); - } - - callDeleteKnowledgeBase(); - // [END dialogflow_v2_generated_KnowledgeBases_DeleteKnowledgeBase_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.get_knowledge_base.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.get_knowledge_base.js deleted file mode 100644 index 613f3621c71..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.get_knowledge_base.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_KnowledgeBases_GetKnowledgeBase_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the knowledge base to retrieve. - * Format `projects//locations//knowledgeBases/`. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new KnowledgeBasesClient(); - - async function callGetKnowledgeBase() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getKnowledgeBase(request); - console.log(response); - } - - callGetKnowledgeBase(); - // [END dialogflow_v2_generated_KnowledgeBases_GetKnowledgeBase_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.list_knowledge_bases.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.list_knowledge_bases.js deleted file mode 100644 index e27e649ab8b..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.list_knowledge_bases.js +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_KnowledgeBases_ListKnowledgeBases_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project to list of knowledge bases for. - * Format: `projects//locations/`. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return in a single page. By - * default 10 and at most 100. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - /** - * 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). - */ - // const filter = 'abc123' - - // Imports the Dialogflow library - const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new KnowledgeBasesClient(); - - async function callListKnowledgeBases() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listKnowledgeBasesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListKnowledgeBases(); - // [END dialogflow_v2_generated_KnowledgeBases_ListKnowledgeBases_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.update_knowledge_base.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.update_knowledge_base.js deleted file mode 100644 index cd5a5c60058..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/knowledge_bases.update_knowledge_base.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 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'; - -function main(knowledgeBase) { - // [START dialogflow_v2_generated_KnowledgeBases_UpdateKnowledgeBase_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The knowledge base to update. - */ - // const knowledgeBase = {} - /** - * Optional. Not specified means `update all`. - * Currently, only `display_name` can be updated, an InvalidArgument will be - * returned for attempting to update other fields. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new KnowledgeBasesClient(); - - async function callUpdateKnowledgeBase() { - // Construct request - const request = { - knowledgeBase, - }; - - // Run request - const response = await dialogflowClient.updateKnowledgeBase(request); - console.log(response); - } - - callUpdateKnowledgeBase(); - // [END dialogflow_v2_generated_KnowledgeBases_UpdateKnowledgeBase_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.analyze_content.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.analyze_content.js deleted file mode 100644 index a8740f5355f..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.analyze_content.js +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2022 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'; - -function main(participant) { - // [START dialogflow_v2_generated_Participants_AnalyzeContent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the participant this text comes from. - * Format: `projects//locations//conversations//participants/`. - */ - // const participant = 'abc123' - /** - * The natural language text to be processed. - */ - // const textInput = {} - /** - * An input event to send to Dialogflow. - */ - // const eventInput = {} - /** - * 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. - */ - // const replyAudioConfig = {} - /** - * Parameters for a Dialogflow virtual-agent query. - */ - // const queryParams = {} - /** - * Parameters for a human assist query. - */ - // const assistQueryParams = {} - /** - * Additional parameters to be put into Dialogflow CX session parameters. To - * remove a parameter from the session, clients should explicitly set the - * parameter value to null. - * Note: this field should only be used if you are connecting to a Dialogflow - * CX agent. - */ - // const cxParameters = {} - /** - * 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. - */ - // const requestId = 'abc123' - - // Imports the Dialogflow library - const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ParticipantsClient(); - - async function callAnalyzeContent() { - // Construct request - const request = { - participant, - }; - - // Run request - const response = await dialogflowClient.analyzeContent(request); - console.log(response); - } - - callAnalyzeContent(); - // [END dialogflow_v2_generated_Participants_AnalyzeContent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.create_participant.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.create_participant.js deleted file mode 100644 index 13451c6bf04..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.create_participant.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, participant) { - // [START dialogflow_v2_generated_Participants_CreateParticipant_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource identifier of the conversation adding the participant. - * Format: `projects//locations//conversations/`. - */ - // const parent = 'abc123' - /** - * Required. The participant to create. - */ - // const participant = {} - - // Imports the Dialogflow library - const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ParticipantsClient(); - - async function callCreateParticipant() { - // Construct request - const request = { - parent, - participant, - }; - - // Run request - const response = await dialogflowClient.createParticipant(request); - console.log(response); - } - - callCreateParticipant(); - // [END dialogflow_v2_generated_Participants_CreateParticipant_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.get_participant.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.get_participant.js deleted file mode 100644 index a40d3c106cf..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.get_participant.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_Participants_GetParticipant_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the participant. Format: - * `projects//locations//conversations//participants/`. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ParticipantsClient(); - - async function callGetParticipant() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getParticipant(request); - console.log(response); - } - - callGetParticipant(); - // [END dialogflow_v2_generated_Participants_GetParticipant_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.list_participants.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.list_participants.js deleted file mode 100644 index 8b95d039a33..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.list_participants.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_Participants_ListParticipants_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The conversation to list all participants from. - * Format: `projects//locations//conversations/`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ParticipantsClient(); - - async function callListParticipants() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listParticipantsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListParticipants(); - // [END dialogflow_v2_generated_Participants_ListParticipants_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.streaming_analyze_content.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.streaming_analyze_content.js deleted file mode 100644 index 5077043f390..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.streaming_analyze_content.js +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright 2022 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'; - -function main(participant) { - // [START dialogflow_v2_generated_Participants_StreamingAnalyzeContent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the participant this text comes from. - * Format: `projects//locations//conversations//participants/`. - */ - // const participant = 'abc123' - /** - * Instructs the speech recognizer how to process the speech audio. - */ - // const audioConfig = {} - /** - * The natural language text to be processed. - */ - // const textConfig = {} - /** - * 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 - * StreamingAnalyzeContent. If this configuration is not supplied, speech - * synthesis is disabled. - */ - // const replyAudioConfig = {} - /** - * The input audio content to be recognized. Must be sent if `audio_config` - * is set in the first message. The complete audio over all streaming - * messages must not exceed 1 minute. - */ - // const inputAudio = 'Buffer.from('string')' - /** - * The UTF-8 encoded natural language text to be processed. Must be sent if - * `text_config` is set in the first message. Text length must not exceed - * 256 bytes for virtual agent interactions. The `input_text` field can be - * only sent once. - */ - // const inputText = 'abc123' - /** - * The DTMF digits used to invoke intent and fill in parameter value. - * This input is ignored if the previous response indicated that DTMF input - * is not accepted. - */ - // const inputDtmf = {} - /** - * Parameters for a Dialogflow virtual-agent query. - */ - // const queryParams = {} - /** - * Parameters for a human assist query. - */ - // const assistQueryParams = {} - /** - * Additional parameters to be put into Dialogflow CX session parameters. To - * remove a parameter from the session, clients should explicitly set the - * parameter value to null. - * Note: this field should only be used if you are connecting to a Dialogflow - * CX agent. - */ - // const cxParameters = {} - /** - * Enable partial virtual agent responses. If this flag is not enabled, - * response stream still contains only one final response even if some - * `Fulfillment`s in Dialogflow virtual agent have been configured to return - * partial responses. - */ - // const enablePartialAutomatedAgentReply = true - - // Imports the Dialogflow library - const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ParticipantsClient(); - - async function callStreamingAnalyzeContent() { - // Construct request - const request = { - participant, - }; - - // Run request - const stream = await dialogflowClient.streamingAnalyzeContent(); - stream.on('data', (response) => { console.log(response) }); - stream.on('error', (err) => { throw(err) }); - stream.on('end', () => { /* API call completed */ }); - stream.write(request); - stream.end(); - } - - callStreamingAnalyzeContent(); - // [END dialogflow_v2_generated_Participants_StreamingAnalyzeContent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.suggest_articles.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.suggest_articles.js deleted file mode 100644 index 794835e5bd4..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.suggest_articles.js +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_Participants_SuggestArticles_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the participant to fetch suggestion for. - * Format: `projects//locations//conversations//participants/`. - */ - // const parent = 'abc123' - /** - * 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/`. - */ - // const latestMessage = 'abc123' - /** - * Optional. 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. - */ - // const contextSize = 1234 - /** - * Parameters for a human assist query. - */ - // const assistQueryParams = {} - - // Imports the Dialogflow library - const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ParticipantsClient(); - - async function callSuggestArticles() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await dialogflowClient.suggestArticles(request); - console.log(response); - } - - callSuggestArticles(); - // [END dialogflow_v2_generated_Participants_SuggestArticles_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.suggest_faq_answers.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.suggest_faq_answers.js deleted file mode 100644 index ea6953e2593..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.suggest_faq_answers.js +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_Participants_SuggestFaqAnswers_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the participant to fetch suggestion for. - * Format: `projects//locations//conversations//participants/`. - */ - // const parent = 'abc123' - /** - * 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/`. - */ - // const latestMessage = 'abc123' - /** - * 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. - */ - // const contextSize = 1234 - /** - * Parameters for a human assist query. - */ - // const assistQueryParams = {} - - // Imports the Dialogflow library - const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ParticipantsClient(); - - async function callSuggestFaqAnswers() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await dialogflowClient.suggestFaqAnswers(request); - console.log(response); - } - - callSuggestFaqAnswers(); - // [END dialogflow_v2_generated_Participants_SuggestFaqAnswers_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.suggest_smart_replies.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.suggest_smart_replies.js deleted file mode 100644 index 6e15c4d4a83..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.suggest_smart_replies.js +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_Participants_SuggestSmartReplies_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the participant to fetch suggestion for. - * Format: `projects//locations//conversations//participants/`. - */ - // const parent = 'abc123' - /** - * 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. - */ - // const currentTextInput = {} - /** - * 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/`. - */ - // const latestMessage = 'abc123' - /** - * 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. - */ - // const contextSize = 1234 - - // Imports the Dialogflow library - const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ParticipantsClient(); - - async function callSuggestSmartReplies() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await dialogflowClient.suggestSmartReplies(request); - console.log(response); - } - - callSuggestSmartReplies(); - // [END dialogflow_v2_generated_Participants_SuggestSmartReplies_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.update_participant.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.update_participant.js deleted file mode 100644 index 1f54b8d8bb8..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/participants.update_participant.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2022 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'; - -function main(participant, updateMask) { - // [START dialogflow_v2_generated_Participants_UpdateParticipant_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The participant to update. - */ - // const participant = {} - /** - * Required. The mask to specify which fields to update. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new ParticipantsClient(); - - async function callUpdateParticipant() { - // Construct request - const request = { - participant, - updateMask, - }; - - // Run request - const response = await dialogflowClient.updateParticipant(request); - console.log(response); - } - - callUpdateParticipant(); - // [END dialogflow_v2_generated_Participants_UpdateParticipant_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.create_session_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.create_session_entity_type.js deleted file mode 100644 index 6326d522ce5..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.create_session_entity_type.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, sessionEntityType) { - // [START dialogflow_v2_generated_SessionEntityTypes_CreateSessionEntityType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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. - */ - // const parent = 'abc123' - /** - * Required. The session entity type to create. - */ - // const sessionEntityType = {} - - // Imports the Dialogflow library - const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new SessionEntityTypesClient(); - - async function callCreateSessionEntityType() { - // Construct request - const request = { - parent, - sessionEntityType, - }; - - // Run request - const response = await dialogflowClient.createSessionEntityType(request); - console.log(response); - } - - callCreateSessionEntityType(); - // [END dialogflow_v2_generated_SessionEntityTypes_CreateSessionEntityType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.delete_session_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.delete_session_entity_type.js deleted file mode 100644 index ba0bc98c285..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.delete_session_entity_type.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_SessionEntityTypes_DeleteSessionEntityType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new SessionEntityTypesClient(); - - async function callDeleteSessionEntityType() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.deleteSessionEntityType(request); - console.log(response); - } - - callDeleteSessionEntityType(); - // [END dialogflow_v2_generated_SessionEntityTypes_DeleteSessionEntityType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.get_session_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.get_session_entity_type.js deleted file mode 100644 index 7a60b72fce0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.get_session_entity_type.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_SessionEntityTypes_GetSessionEntityType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new SessionEntityTypesClient(); - - async function callGetSessionEntityType() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getSessionEntityType(request); - console.log(response); - } - - callGetSessionEntityType(); - // [END dialogflow_v2_generated_SessionEntityTypes_GetSessionEntityType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.list_session_entity_types.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.list_session_entity_types.js deleted file mode 100644 index 87ccdabb650..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.list_session_entity_types.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_SessionEntityTypes_ListSessionEntityTypes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new SessionEntityTypesClient(); - - async function callListSessionEntityTypes() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listSessionEntityTypesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListSessionEntityTypes(); - // [END dialogflow_v2_generated_SessionEntityTypes_ListSessionEntityTypes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.update_session_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.update_session_entity_type.js deleted file mode 100644 index 1976e6fd8ee..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/session_entity_types.update_session_entity_type.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 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'; - -function main(sessionEntityType) { - // [START dialogflow_v2_generated_SessionEntityTypes_UpdateSessionEntityType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The session entity type to update. - */ - // const sessionEntityType = {} - /** - * Optional. The mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new SessionEntityTypesClient(); - - async function callUpdateSessionEntityType() { - // Construct request - const request = { - sessionEntityType, - }; - - // Run request - const response = await dialogflowClient.updateSessionEntityType(request); - console.log(response); - } - - callUpdateSessionEntityType(); - // [END dialogflow_v2_generated_SessionEntityTypes_UpdateSessionEntityType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/sessions.detect_intent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/sessions.detect_intent.js deleted file mode 100644 index 5c9419e8c4a..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/sessions.detect_intent.js +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright 2022 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'; - -function main(session, queryInput) { - // [START dialogflow_v2_generated_Sessions_DetectIntent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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). - */ - // const session = 'abc123' - /** - * The parameters of this query. - */ - // const queryParams = {} - /** - * 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. - */ - // const queryInput = {} - /** - * 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. - */ - // const outputAudioConfig = {} - /** - * 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. - */ - // const outputAudioConfigMask = {} - /** - * 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. - */ - // const inputAudio = 'Buffer.from('string')' - - // Imports the Dialogflow library - const {SessionsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new SessionsClient(); - - async function callDetectIntent() { - // Construct request - const request = { - session, - queryInput, - }; - - // Run request - const response = await dialogflowClient.detectIntent(request); - console.log(response); - } - - callDetectIntent(); - // [END dialogflow_v2_generated_Sessions_DetectIntent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/sessions.streaming_detect_intent.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/sessions.streaming_detect_intent.js deleted file mode 100644 index 50370fc7c94..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/sessions.streaming_detect_intent.js +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright 2022 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'; - -function main(session, queryInput) { - // [START dialogflow_v2_generated_Sessions_StreamingDetectIntent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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). - */ - // const session = 'abc123' - /** - * The parameters of this query. - */ - // const queryParams = {} - /** - * 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. - */ - // const queryInput = {} - /** - * 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. - */ - // const singleUtterance = 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. - */ - // const outputAudioConfig = {} - /** - * 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. - */ - // const outputAudioConfigMask = {} - /** - * 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. - */ - // const inputAudio = 'Buffer.from('string')' - - // Imports the Dialogflow library - const {SessionsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new SessionsClient(); - - async function callStreamingDetectIntent() { - // Construct request - const request = { - session, - queryInput, - }; - - // Run request - const stream = await dialogflowClient.streamingDetectIntent(); - stream.on('data', (response) => { console.log(response) }); - stream.on('error', (err) => { throw(err) }); - stream.on('end', () => { /* API call completed */ }); - stream.write(request); - stream.end(); - } - - callStreamingDetectIntent(); - // [END dialogflow_v2_generated_Sessions_StreamingDetectIntent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/snippet_metadata.google.cloud.dialogflow.v2.json b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/snippet_metadata.google.cloud.dialogflow.v2.json deleted file mode 100644 index 228fd7d6c00..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/snippet_metadata.google.cloud.dialogflow.v2.json +++ /dev/null @@ -1,4731 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-dialogflow", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.dialogflow.v2", - "version": "v2" - } - ] - }, - "snippets": [ - { - "regionTag": "dialogflow_v2_generated_Agents_GetAgent_async", - "title": "dialogflow getAgent Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the specified agent.", - "canonical": true, - "file": "agents.get_agent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAgent", - "fullName": "google.cloud.dialogflow.v2.Agents.GetAgent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.Agent", - "client": { - "shortName": "AgentsClient", - "fullName": "google.cloud.dialogflow.v2.AgentsClient" - }, - "method": { - "shortName": "GetAgent", - "fullName": "google.cloud.dialogflow.v2.Agents.GetAgent", - "service": { - "shortName": "Agents", - "fullName": "google.cloud.dialogflow.v2.Agents" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Agents_SetAgent_async", - "title": "dialogflow setAgent Sample", - "origin": "API_DEFINITION", - "description": " 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).", - "canonical": true, - "file": "agents.set_agent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetAgent", - "fullName": "google.cloud.dialogflow.v2.Agents.SetAgent", - "async": true, - "parameters": [ - { - "name": "agent", - "type": ".google.cloud.dialogflow.v2.Agent" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.dialogflow.v2.Agent", - "client": { - "shortName": "AgentsClient", - "fullName": "google.cloud.dialogflow.v2.AgentsClient" - }, - "method": { - "shortName": "SetAgent", - "fullName": "google.cloud.dialogflow.v2.Agents.SetAgent", - "service": { - "shortName": "Agents", - "fullName": "google.cloud.dialogflow.v2.Agents" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Agents_DeleteAgent_async", - "title": "dialogflow deleteAgent Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified agent.", - "canonical": true, - "file": "agents.delete_agent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteAgent", - "fullName": "google.cloud.dialogflow.v2.Agents.DeleteAgent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "AgentsClient", - "fullName": "google.cloud.dialogflow.v2.AgentsClient" - }, - "method": { - "shortName": "DeleteAgent", - "fullName": "google.cloud.dialogflow.v2.Agents.DeleteAgent", - "service": { - "shortName": "Agents", - "fullName": "google.cloud.dialogflow.v2.Agents" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Agents_SearchAgents_async", - "title": "dialogflow searchAgents Sample", - "origin": "API_DEFINITION", - "description": " 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).", - "canonical": true, - "file": "agents.search_agents.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SearchAgents", - "fullName": "google.cloud.dialogflow.v2.Agents.SearchAgents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.SearchAgentsResponse", - "client": { - "shortName": "AgentsClient", - "fullName": "google.cloud.dialogflow.v2.AgentsClient" - }, - "method": { - "shortName": "SearchAgents", - "fullName": "google.cloud.dialogflow.v2.Agents.SearchAgents", - "service": { - "shortName": "Agents", - "fullName": "google.cloud.dialogflow.v2.Agents" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Agents_TrainAgent_async", - "title": "dialogflow trainAgent Sample", - "origin": "API_DEFINITION", - "description": " Trains the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", - "canonical": true, - "file": "agents.train_agent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TrainAgent", - "fullName": "google.cloud.dialogflow.v2.Agents.TrainAgent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AgentsClient", - "fullName": "google.cloud.dialogflow.v2.AgentsClient" - }, - "method": { - "shortName": "TrainAgent", - "fullName": "google.cloud.dialogflow.v2.Agents.TrainAgent", - "service": { - "shortName": "Agents", - "fullName": "google.cloud.dialogflow.v2.Agents" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Agents_ExportAgent_async", - "title": "dialogflow exportAgent Sample", - "origin": "API_DEFINITION", - "description": " Exports the specified agent to a ZIP file. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]", - "canonical": true, - "file": "agents.export_agent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ExportAgent", - "fullName": "google.cloud.dialogflow.v2.Agents.ExportAgent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "agent_uri", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AgentsClient", - "fullName": "google.cloud.dialogflow.v2.AgentsClient" - }, - "method": { - "shortName": "ExportAgent", - "fullName": "google.cloud.dialogflow.v2.Agents.ExportAgent", - "service": { - "shortName": "Agents", - "fullName": "google.cloud.dialogflow.v2.Agents" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Agents_ImportAgent_async", - "title": "dialogflow importAgent Sample", - "origin": "API_DEFINITION", - "description": " 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. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) The operation only tracks when importing is complete, 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).", - "canonical": true, - "file": "agents.import_agent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportAgent", - "fullName": "google.cloud.dialogflow.v2.Agents.ImportAgent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "agent_uri", - "type": "TYPE_STRING" - }, - { - "name": "agent_content", - "type": "TYPE_BYTES" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AgentsClient", - "fullName": "google.cloud.dialogflow.v2.AgentsClient" - }, - "method": { - "shortName": "ImportAgent", - "fullName": "google.cloud.dialogflow.v2.Agents.ImportAgent", - "service": { - "shortName": "Agents", - "fullName": "google.cloud.dialogflow.v2.Agents" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Agents_RestoreAgent_async", - "title": "dialogflow restoreAgent Sample", - "origin": "API_DEFINITION", - "description": " 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. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) The operation only tracks when restoring is complete, 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).", - "canonical": true, - "file": "agents.restore_agent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RestoreAgent", - "fullName": "google.cloud.dialogflow.v2.Agents.RestoreAgent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "agent_uri", - "type": "TYPE_STRING" - }, - { - "name": "agent_content", - "type": "TYPE_BYTES" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AgentsClient", - "fullName": "google.cloud.dialogflow.v2.AgentsClient" - }, - "method": { - "shortName": "RestoreAgent", - "fullName": "google.cloud.dialogflow.v2.Agents.RestoreAgent", - "service": { - "shortName": "Agents", - "fullName": "google.cloud.dialogflow.v2.Agents" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Agents_GetValidationResult_async", - "title": "dialogflow getValidationResult Sample", - "origin": "API_DEFINITION", - "description": " Gets agent validation result. Agent validation is performed during training time and is updated automatically when training is completed.", - "canonical": true, - "file": "agents.get_validation_result.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetValidationResult", - "fullName": "google.cloud.dialogflow.v2.Agents.GetValidationResult", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.ValidationResult", - "client": { - "shortName": "AgentsClient", - "fullName": "google.cloud.dialogflow.v2.AgentsClient" - }, - "method": { - "shortName": "GetValidationResult", - "fullName": "google.cloud.dialogflow.v2.Agents.GetValidationResult", - "service": { - "shortName": "Agents", - "fullName": "google.cloud.dialogflow.v2.Agents" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_AnswerRecords_ListAnswerRecords_async", - "title": "dialogflow listAnswerRecords Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of all answer records in the specified project in reverse chronological order.", - "canonical": true, - "file": "answer_records.list_answer_records.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAnswerRecords", - "fullName": "google.cloud.dialogflow.v2.AnswerRecords.ListAnswerRecords", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.ListAnswerRecordsResponse", - "client": { - "shortName": "AnswerRecordsClient", - "fullName": "google.cloud.dialogflow.v2.AnswerRecordsClient" - }, - "method": { - "shortName": "ListAnswerRecords", - "fullName": "google.cloud.dialogflow.v2.AnswerRecords.ListAnswerRecords", - "service": { - "shortName": "AnswerRecords", - "fullName": "google.cloud.dialogflow.v2.AnswerRecords" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_AnswerRecords_UpdateAnswerRecord_async", - "title": "dialogflow updateAnswerRecord Sample", - "origin": "API_DEFINITION", - "description": " Updates the specified answer record.", - "canonical": true, - "file": "answer_records.update_answer_record.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateAnswerRecord", - "fullName": "google.cloud.dialogflow.v2.AnswerRecords.UpdateAnswerRecord", - "async": true, - "parameters": [ - { - "name": "answer_record", - "type": ".google.cloud.dialogflow.v2.AnswerRecord" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.dialogflow.v2.AnswerRecord", - "client": { - "shortName": "AnswerRecordsClient", - "fullName": "google.cloud.dialogflow.v2.AnswerRecordsClient" - }, - "method": { - "shortName": "UpdateAnswerRecord", - "fullName": "google.cloud.dialogflow.v2.AnswerRecords.UpdateAnswerRecord", - "service": { - "shortName": "AnswerRecords", - "fullName": "google.cloud.dialogflow.v2.AnswerRecords" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Contexts_ListContexts_async", - "title": "dialogflow listContexts Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of all contexts in the specified session.", - "canonical": true, - "file": "contexts.list_contexts.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListContexts", - "fullName": "google.cloud.dialogflow.v2.Contexts.ListContexts", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.ListContextsResponse", - "client": { - "shortName": "ContextsClient", - "fullName": "google.cloud.dialogflow.v2.ContextsClient" - }, - "method": { - "shortName": "ListContexts", - "fullName": "google.cloud.dialogflow.v2.Contexts.ListContexts", - "service": { - "shortName": "Contexts", - "fullName": "google.cloud.dialogflow.v2.Contexts" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Contexts_GetContext_async", - "title": "dialogflow getContext Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the specified context.", - "canonical": true, - "file": "contexts.get_context.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetContext", - "fullName": "google.cloud.dialogflow.v2.Contexts.GetContext", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.Context", - "client": { - "shortName": "ContextsClient", - "fullName": "google.cloud.dialogflow.v2.ContextsClient" - }, - "method": { - "shortName": "GetContext", - "fullName": "google.cloud.dialogflow.v2.Contexts.GetContext", - "service": { - "shortName": "Contexts", - "fullName": "google.cloud.dialogflow.v2.Contexts" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Contexts_CreateContext_async", - "title": "dialogflow createContext Sample", - "origin": "API_DEFINITION", - "description": " Creates a context. If the specified context already exists, overrides the context.", - "canonical": true, - "file": "contexts.create_context.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateContext", - "fullName": "google.cloud.dialogflow.v2.Contexts.CreateContext", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "context", - "type": ".google.cloud.dialogflow.v2.Context" - } - ], - "resultType": ".google.cloud.dialogflow.v2.Context", - "client": { - "shortName": "ContextsClient", - "fullName": "google.cloud.dialogflow.v2.ContextsClient" - }, - "method": { - "shortName": "CreateContext", - "fullName": "google.cloud.dialogflow.v2.Contexts.CreateContext", - "service": { - "shortName": "Contexts", - "fullName": "google.cloud.dialogflow.v2.Contexts" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Contexts_UpdateContext_async", - "title": "dialogflow updateContext Sample", - "origin": "API_DEFINITION", - "description": " Updates the specified context.", - "canonical": true, - "file": "contexts.update_context.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateContext", - "fullName": "google.cloud.dialogflow.v2.Contexts.UpdateContext", - "async": true, - "parameters": [ - { - "name": "context", - "type": ".google.cloud.dialogflow.v2.Context" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.dialogflow.v2.Context", - "client": { - "shortName": "ContextsClient", - "fullName": "google.cloud.dialogflow.v2.ContextsClient" - }, - "method": { - "shortName": "UpdateContext", - "fullName": "google.cloud.dialogflow.v2.Contexts.UpdateContext", - "service": { - "shortName": "Contexts", - "fullName": "google.cloud.dialogflow.v2.Contexts" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Contexts_DeleteContext_async", - "title": "dialogflow deleteContext Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified context.", - "canonical": true, - "file": "contexts.delete_context.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteContext", - "fullName": "google.cloud.dialogflow.v2.Contexts.DeleteContext", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ContextsClient", - "fullName": "google.cloud.dialogflow.v2.ContextsClient" - }, - "method": { - "shortName": "DeleteContext", - "fullName": "google.cloud.dialogflow.v2.Contexts.DeleteContext", - "service": { - "shortName": "Contexts", - "fullName": "google.cloud.dialogflow.v2.Contexts" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Contexts_DeleteAllContexts_async", - "title": "dialogflow deleteAllContexts Sample", - "origin": "API_DEFINITION", - "description": " Deletes all active contexts in the specified session.", - "canonical": true, - "file": "contexts.delete_all_contexts.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteAllContexts", - "fullName": "google.cloud.dialogflow.v2.Contexts.DeleteAllContexts", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ContextsClient", - "fullName": "google.cloud.dialogflow.v2.ContextsClient" - }, - "method": { - "shortName": "DeleteAllContexts", - "fullName": "google.cloud.dialogflow.v2.Contexts.DeleteAllContexts", - "service": { - "shortName": "Contexts", - "fullName": "google.cloud.dialogflow.v2.Contexts" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_ConversationDatasets_CreateConversationDataset_async", - "title": "dialogflow createConversationDataset Sample", - "origin": "API_DEFINITION", - "description": " Creates a new conversation dataset. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [CreateConversationDatasetOperationMetadata][google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata] - `response`: [ConversationDataset][google.cloud.dialogflow.v2.ConversationDataset]", - "canonical": true, - "file": "conversation_datasets.create_conversation_dataset.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateConversationDataset", - "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.CreateConversationDataset", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "conversation_dataset", - "type": ".google.cloud.dialogflow.v2.ConversationDataset" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ConversationDatasetsClient", - "fullName": "google.cloud.dialogflow.v2.ConversationDatasetsClient" - }, - "method": { - "shortName": "CreateConversationDataset", - "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.CreateConversationDataset", - "service": { - "shortName": "ConversationDatasets", - "fullName": "google.cloud.dialogflow.v2.ConversationDatasets" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_ConversationDatasets_GetConversationDataset_async", - "title": "dialogflow getConversationDataset Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the specified conversation dataset.", - "canonical": true, - "file": "conversation_datasets.get_conversation_dataset.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetConversationDataset", - "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.GetConversationDataset", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.ConversationDataset", - "client": { - "shortName": "ConversationDatasetsClient", - "fullName": "google.cloud.dialogflow.v2.ConversationDatasetsClient" - }, - "method": { - "shortName": "GetConversationDataset", - "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.GetConversationDataset", - "service": { - "shortName": "ConversationDatasets", - "fullName": "google.cloud.dialogflow.v2.ConversationDatasets" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_ConversationDatasets_ListConversationDatasets_async", - "title": "dialogflow listConversationDatasets Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of all conversation datasets in the specified project and location.", - "canonical": true, - "file": "conversation_datasets.list_conversation_datasets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListConversationDatasets", - "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.ListConversationDatasets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.ListConversationDatasetsResponse", - "client": { - "shortName": "ConversationDatasetsClient", - "fullName": "google.cloud.dialogflow.v2.ConversationDatasetsClient" - }, - "method": { - "shortName": "ListConversationDatasets", - "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.ListConversationDatasets", - "service": { - "shortName": "ConversationDatasets", - "fullName": "google.cloud.dialogflow.v2.ConversationDatasets" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_ConversationDatasets_DeleteConversationDataset_async", - "title": "dialogflow deleteConversationDataset Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified conversation dataset. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [DeleteConversationDatasetOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)", - "canonical": true, - "file": "conversation_datasets.delete_conversation_dataset.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteConversationDataset", - "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.DeleteConversationDataset", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ConversationDatasetsClient", - "fullName": "google.cloud.dialogflow.v2.ConversationDatasetsClient" - }, - "method": { - "shortName": "DeleteConversationDataset", - "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.DeleteConversationDataset", - "service": { - "shortName": "ConversationDatasets", - "fullName": "google.cloud.dialogflow.v2.ConversationDatasets" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_ConversationDatasets_ImportConversationData_async", - "title": "dialogflow importConversationData Sample", - "origin": "API_DEFINITION", - "description": " Import data into the specified conversation dataset. Note that it is not allowed to import data to a conversation dataset that already has data in it. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [ImportConversationDataOperationMetadata][google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata] - `response`: [ImportConversationDataOperationResponse][google.cloud.dialogflow.v2.ImportConversationDataOperationResponse]", - "canonical": true, - "file": "conversation_datasets.import_conversation_data.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportConversationData", - "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "input_config", - "type": ".google.cloud.dialogflow.v2.InputConfig" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ConversationDatasetsClient", - "fullName": "google.cloud.dialogflow.v2.ConversationDatasetsClient" - }, - "method": { - "shortName": "ImportConversationData", - "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData", - "service": { - "shortName": "ConversationDatasets", - "fullName": "google.cloud.dialogflow.v2.ConversationDatasets" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_ConversationModels_CreateConversationModel_async", - "title": "dialogflow createConversationModel Sample", - "origin": "API_DEFINITION", - "description": " Creates a model. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [CreateConversationModelOperationMetadata][google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata] - `response`: [ConversationModel][google.cloud.dialogflow.v2.ConversationModel]", - "canonical": true, - "file": "conversation_models.create_conversation_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateConversationModel", - "fullName": "google.cloud.dialogflow.v2.ConversationModels.CreateConversationModel", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "conversation_model", - "type": ".google.cloud.dialogflow.v2.ConversationModel" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ConversationModelsClient", - "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" - }, - "method": { - "shortName": "CreateConversationModel", - "fullName": "google.cloud.dialogflow.v2.ConversationModels.CreateConversationModel", - "service": { - "shortName": "ConversationModels", - "fullName": "google.cloud.dialogflow.v2.ConversationModels" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_ConversationModels_GetConversationModel_async", - "title": "dialogflow getConversationModel Sample", - "origin": "API_DEFINITION", - "description": " Gets conversation model.", - "canonical": true, - "file": "conversation_models.get_conversation_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetConversationModel", - "fullName": "google.cloud.dialogflow.v2.ConversationModels.GetConversationModel", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.ConversationModel", - "client": { - "shortName": "ConversationModelsClient", - "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" - }, - "method": { - "shortName": "GetConversationModel", - "fullName": "google.cloud.dialogflow.v2.ConversationModels.GetConversationModel", - "service": { - "shortName": "ConversationModels", - "fullName": "google.cloud.dialogflow.v2.ConversationModels" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_ConversationModels_ListConversationModels_async", - "title": "dialogflow listConversationModels Sample", - "origin": "API_DEFINITION", - "description": " Lists conversation models.", - "canonical": true, - "file": "conversation_models.list_conversation_models.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListConversationModels", - "fullName": "google.cloud.dialogflow.v2.ConversationModels.ListConversationModels", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.ListConversationModelsResponse", - "client": { - "shortName": "ConversationModelsClient", - "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" - }, - "method": { - "shortName": "ListConversationModels", - "fullName": "google.cloud.dialogflow.v2.ConversationModels.ListConversationModels", - "service": { - "shortName": "ConversationModels", - "fullName": "google.cloud.dialogflow.v2.ConversationModels" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_ConversationModels_DeleteConversationModel_async", - "title": "dialogflow deleteConversationModel Sample", - "origin": "API_DEFINITION", - "description": " Deletes a model. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [DeleteConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)", - "canonical": true, - "file": "conversation_models.delete_conversation_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteConversationModel", - "fullName": "google.cloud.dialogflow.v2.ConversationModels.DeleteConversationModel", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ConversationModelsClient", - "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" - }, - "method": { - "shortName": "DeleteConversationModel", - "fullName": "google.cloud.dialogflow.v2.ConversationModels.DeleteConversationModel", - "service": { - "shortName": "ConversationModels", - "fullName": "google.cloud.dialogflow.v2.ConversationModels" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_ConversationModels_DeployConversationModel_async", - "title": "dialogflow deployConversationModel Sample", - "origin": "API_DEFINITION", - "description": " Deploys a model. If a model is already deployed, deploying it has no effect. A model can only serve prediction requests after it gets deployed. For article suggestion, custom model will not be used unless it is deployed. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [DeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)", - "canonical": true, - "file": "conversation_models.deploy_conversation_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeployConversationModel", - "fullName": "google.cloud.dialogflow.v2.ConversationModels.DeployConversationModel", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ConversationModelsClient", - "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" - }, - "method": { - "shortName": "DeployConversationModel", - "fullName": "google.cloud.dialogflow.v2.ConversationModels.DeployConversationModel", - "service": { - "shortName": "ConversationModels", - "fullName": "google.cloud.dialogflow.v2.ConversationModels" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_ConversationModels_UndeployConversationModel_async", - "title": "dialogflow undeployConversationModel Sample", - "origin": "API_DEFINITION", - "description": " Undeploys a model. If the model is not deployed this method has no effect. If the model is currently being used: - For article suggestion, article suggestion will fallback to the default model if model is undeployed. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [UndeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)", - "canonical": true, - "file": "conversation_models.undeploy_conversation_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UndeployConversationModel", - "fullName": "google.cloud.dialogflow.v2.ConversationModels.UndeployConversationModel", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ConversationModelsClient", - "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" - }, - "method": { - "shortName": "UndeployConversationModel", - "fullName": "google.cloud.dialogflow.v2.ConversationModels.UndeployConversationModel", - "service": { - "shortName": "ConversationModels", - "fullName": "google.cloud.dialogflow.v2.ConversationModels" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_ConversationModels_GetConversationModelEvaluation_async", - "title": "dialogflow getConversationModelEvaluation Sample", - "origin": "API_DEFINITION", - "description": " Gets an evaluation of conversation model.", - "canonical": true, - "file": "conversation_models.get_conversation_model_evaluation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetConversationModelEvaluation", - "fullName": "google.cloud.dialogflow.v2.ConversationModels.GetConversationModelEvaluation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.ConversationModelEvaluation", - "client": { - "shortName": "ConversationModelsClient", - "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" - }, - "method": { - "shortName": "GetConversationModelEvaluation", - "fullName": "google.cloud.dialogflow.v2.ConversationModels.GetConversationModelEvaluation", - "service": { - "shortName": "ConversationModels", - "fullName": "google.cloud.dialogflow.v2.ConversationModels" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_ConversationModels_ListConversationModelEvaluations_async", - "title": "dialogflow listConversationModelEvaluations Sample", - "origin": "API_DEFINITION", - "description": " Lists evaluations of a conversation model.", - "canonical": true, - "file": "conversation_models.list_conversation_model_evaluations.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListConversationModelEvaluations", - "fullName": "google.cloud.dialogflow.v2.ConversationModels.ListConversationModelEvaluations", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse", - "client": { - "shortName": "ConversationModelsClient", - "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" - }, - "method": { - "shortName": "ListConversationModelEvaluations", - "fullName": "google.cloud.dialogflow.v2.ConversationModels.ListConversationModelEvaluations", - "service": { - "shortName": "ConversationModels", - "fullName": "google.cloud.dialogflow.v2.ConversationModels" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_ConversationModels_CreateConversationModelEvaluation_async", - "title": "dialogflow createConversationModelEvaluation Sample", - "origin": "API_DEFINITION", - "description": " Creates evaluation of a conversation model.", - "canonical": true, - "file": "conversation_models.create_conversation_model_evaluation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateConversationModelEvaluation", - "fullName": "google.cloud.dialogflow.v2.ConversationModels.CreateConversationModelEvaluation", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "conversation_model_evaluation", - "type": ".google.cloud.dialogflow.v2.ConversationModelEvaluation" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ConversationModelsClient", - "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" - }, - "method": { - "shortName": "CreateConversationModelEvaluation", - "fullName": "google.cloud.dialogflow.v2.ConversationModels.CreateConversationModelEvaluation", - "service": { - "shortName": "ConversationModels", - "fullName": "google.cloud.dialogflow.v2.ConversationModels" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_ConversationProfiles_ListConversationProfiles_async", - "title": "dialogflow listConversationProfiles Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of all conversation profiles in the specified project.", - "canonical": true, - "file": "conversation_profiles.list_conversation_profiles.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListConversationProfiles", - "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.ListConversationProfiles", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.ListConversationProfilesResponse", - "client": { - "shortName": "ConversationProfilesClient", - "fullName": "google.cloud.dialogflow.v2.ConversationProfilesClient" - }, - "method": { - "shortName": "ListConversationProfiles", - "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.ListConversationProfiles", - "service": { - "shortName": "ConversationProfiles", - "fullName": "google.cloud.dialogflow.v2.ConversationProfiles" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_ConversationProfiles_GetConversationProfile_async", - "title": "dialogflow getConversationProfile Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the specified conversation profile.", - "canonical": true, - "file": "conversation_profiles.get_conversation_profile.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetConversationProfile", - "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.ConversationProfile", - "client": { - "shortName": "ConversationProfilesClient", - "fullName": "google.cloud.dialogflow.v2.ConversationProfilesClient" - }, - "method": { - "shortName": "GetConversationProfile", - "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile", - "service": { - "shortName": "ConversationProfiles", - "fullName": "google.cloud.dialogflow.v2.ConversationProfiles" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_ConversationProfiles_CreateConversationProfile_async", - "title": "dialogflow createConversationProfile Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "conversation_profiles.create_conversation_profile.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateConversationProfile", - "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.CreateConversationProfile", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "conversation_profile", - "type": ".google.cloud.dialogflow.v2.ConversationProfile" - } - ], - "resultType": ".google.cloud.dialogflow.v2.ConversationProfile", - "client": { - "shortName": "ConversationProfilesClient", - "fullName": "google.cloud.dialogflow.v2.ConversationProfilesClient" - }, - "method": { - "shortName": "CreateConversationProfile", - "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.CreateConversationProfile", - "service": { - "shortName": "ConversationProfiles", - "fullName": "google.cloud.dialogflow.v2.ConversationProfiles" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_ConversationProfiles_UpdateConversationProfile_async", - "title": "dialogflow updateConversationProfile Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "conversation_profiles.update_conversation_profile.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateConversationProfile", - "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.UpdateConversationProfile", - "async": true, - "parameters": [ - { - "name": "conversation_profile", - "type": ".google.cloud.dialogflow.v2.ConversationProfile" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.dialogflow.v2.ConversationProfile", - "client": { - "shortName": "ConversationProfilesClient", - "fullName": "google.cloud.dialogflow.v2.ConversationProfilesClient" - }, - "method": { - "shortName": "UpdateConversationProfile", - "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.UpdateConversationProfile", - "service": { - "shortName": "ConversationProfiles", - "fullName": "google.cloud.dialogflow.v2.ConversationProfiles" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_ConversationProfiles_DeleteConversationProfile_async", - "title": "dialogflow deleteConversationProfile Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified conversation profile.", - "canonical": true, - "file": "conversation_profiles.delete_conversation_profile.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteConversationProfile", - "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.DeleteConversationProfile", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ConversationProfilesClient", - "fullName": "google.cloud.dialogflow.v2.ConversationProfilesClient" - }, - "method": { - "shortName": "DeleteConversationProfile", - "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.DeleteConversationProfile", - "service": { - "shortName": "ConversationProfiles", - "fullName": "google.cloud.dialogflow.v2.ConversationProfiles" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_ConversationProfiles_SetSuggestionFeatureConfig_async", - "title": "dialogflow setSuggestionFeatureConfig Sample", - "origin": "API_DEFINITION", - "description": " Adds or updates a suggestion feature in a conversation profile. If the conversation profile contains the type of suggestion feature for the participant role, it will update it. Otherwise it will insert the suggestion feature. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [SetSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata] - `response`: [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile] If a long running operation to add or update suggestion feature config for the same conversation profile, participant role and suggestion feature type exists, please cancel the existing long running operation before sending such request, otherwise the request will be rejected.", - "canonical": true, - "file": "conversation_profiles.set_suggestion_feature_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetSuggestionFeatureConfig", - "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.SetSuggestionFeatureConfig", - "async": true, - "parameters": [ - { - "name": "conversation_profile", - "type": "TYPE_STRING" - }, - { - "name": "participant_role", - "type": ".google.cloud.dialogflow.v2.Participant.Role" - }, - { - "name": "suggestion_feature_config", - "type": ".google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ConversationProfilesClient", - "fullName": "google.cloud.dialogflow.v2.ConversationProfilesClient" - }, - "method": { - "shortName": "SetSuggestionFeatureConfig", - "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.SetSuggestionFeatureConfig", - "service": { - "shortName": "ConversationProfiles", - "fullName": "google.cloud.dialogflow.v2.ConversationProfiles" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async", - "title": "dialogflow clearSuggestionFeatureConfig Sample", - "origin": "API_DEFINITION", - "description": " Clears a suggestion feature from a conversation profile for the given participant role. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [ClearSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata] - `response`: [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile]", - "canonical": true, - "file": "conversation_profiles.clear_suggestion_feature_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ClearSuggestionFeatureConfig", - "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.ClearSuggestionFeatureConfig", - "async": true, - "parameters": [ - { - "name": "conversation_profile", - "type": "TYPE_STRING" - }, - { - "name": "participant_role", - "type": ".google.cloud.dialogflow.v2.Participant.Role" - }, - { - "name": "suggestion_feature_type", - "type": ".google.cloud.dialogflow.v2.SuggestionFeature.Type" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ConversationProfilesClient", - "fullName": "google.cloud.dialogflow.v2.ConversationProfilesClient" - }, - "method": { - "shortName": "ClearSuggestionFeatureConfig", - "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.ClearSuggestionFeatureConfig", - "service": { - "shortName": "ConversationProfiles", - "fullName": "google.cloud.dialogflow.v2.ConversationProfiles" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Conversations_CreateConversation_async", - "title": "dialogflow createConversation Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "conversations.create_conversation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateConversation", - "fullName": "google.cloud.dialogflow.v2.Conversations.CreateConversation", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "conversation", - "type": ".google.cloud.dialogflow.v2.Conversation" - }, - { - "name": "conversation_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.Conversation", - "client": { - "shortName": "ConversationsClient", - "fullName": "google.cloud.dialogflow.v2.ConversationsClient" - }, - "method": { - "shortName": "CreateConversation", - "fullName": "google.cloud.dialogflow.v2.Conversations.CreateConversation", - "service": { - "shortName": "Conversations", - "fullName": "google.cloud.dialogflow.v2.Conversations" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Conversations_ListConversations_async", - "title": "dialogflow listConversations Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of all conversations in the specified project.", - "canonical": true, - "file": "conversations.list_conversations.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListConversations", - "fullName": "google.cloud.dialogflow.v2.Conversations.ListConversations", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.ListConversationsResponse", - "client": { - "shortName": "ConversationsClient", - "fullName": "google.cloud.dialogflow.v2.ConversationsClient" - }, - "method": { - "shortName": "ListConversations", - "fullName": "google.cloud.dialogflow.v2.Conversations.ListConversations", - "service": { - "shortName": "Conversations", - "fullName": "google.cloud.dialogflow.v2.Conversations" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Conversations_GetConversation_async", - "title": "dialogflow getConversation Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the specific conversation.", - "canonical": true, - "file": "conversations.get_conversation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetConversation", - "fullName": "google.cloud.dialogflow.v2.Conversations.GetConversation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.Conversation", - "client": { - "shortName": "ConversationsClient", - "fullName": "google.cloud.dialogflow.v2.ConversationsClient" - }, - "method": { - "shortName": "GetConversation", - "fullName": "google.cloud.dialogflow.v2.Conversations.GetConversation", - "service": { - "shortName": "Conversations", - "fullName": "google.cloud.dialogflow.v2.Conversations" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Conversations_CompleteConversation_async", - "title": "dialogflow completeConversation Sample", - "origin": "API_DEFINITION", - "description": " Completes the specified conversation. Finished conversations are purged from the database after 30 days.", - "canonical": true, - "file": "conversations.complete_conversation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CompleteConversation", - "fullName": "google.cloud.dialogflow.v2.Conversations.CompleteConversation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.Conversation", - "client": { - "shortName": "ConversationsClient", - "fullName": "google.cloud.dialogflow.v2.ConversationsClient" - }, - "method": { - "shortName": "CompleteConversation", - "fullName": "google.cloud.dialogflow.v2.Conversations.CompleteConversation", - "service": { - "shortName": "Conversations", - "fullName": "google.cloud.dialogflow.v2.Conversations" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Conversations_ListMessages_async", - "title": "dialogflow listMessages Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "conversations.list_messages.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListMessages", - "fullName": "google.cloud.dialogflow.v2.Conversations.ListMessages", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.ListMessagesResponse", - "client": { - "shortName": "ConversationsClient", - "fullName": "google.cloud.dialogflow.v2.ConversationsClient" - }, - "method": { - "shortName": "ListMessages", - "fullName": "google.cloud.dialogflow.v2.Conversations.ListMessages", - "service": { - "shortName": "Conversations", - "fullName": "google.cloud.dialogflow.v2.Conversations" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Documents_ListDocuments_async", - "title": "dialogflow listDocuments Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of all documents of the knowledge base.", - "canonical": true, - "file": "documents.list_documents.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDocuments", - "fullName": "google.cloud.dialogflow.v2.Documents.ListDocuments", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.ListDocumentsResponse", - "client": { - "shortName": "DocumentsClient", - "fullName": "google.cloud.dialogflow.v2.DocumentsClient" - }, - "method": { - "shortName": "ListDocuments", - "fullName": "google.cloud.dialogflow.v2.Documents.ListDocuments", - "service": { - "shortName": "Documents", - "fullName": "google.cloud.dialogflow.v2.Documents" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Documents_GetDocument_async", - "title": "dialogflow getDocument Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the specified document.", - "canonical": true, - "file": "documents.get_document.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDocument", - "fullName": "google.cloud.dialogflow.v2.Documents.GetDocument", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.Document", - "client": { - "shortName": "DocumentsClient", - "fullName": "google.cloud.dialogflow.v2.DocumentsClient" - }, - "method": { - "shortName": "GetDocument", - "fullName": "google.cloud.dialogflow.v2.Documents.GetDocument", - "service": { - "shortName": "Documents", - "fullName": "google.cloud.dialogflow.v2.Documents" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Documents_CreateDocument_async", - "title": "dialogflow createDocument Sample", - "origin": "API_DEFINITION", - "description": " Creates a new document. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] - `response`: [Document][google.cloud.dialogflow.v2.Document]", - "canonical": true, - "file": "documents.create_document.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateDocument", - "fullName": "google.cloud.dialogflow.v2.Documents.CreateDocument", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "document", - "type": ".google.cloud.dialogflow.v2.Document" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DocumentsClient", - "fullName": "google.cloud.dialogflow.v2.DocumentsClient" - }, - "method": { - "shortName": "CreateDocument", - "fullName": "google.cloud.dialogflow.v2.Documents.CreateDocument", - "service": { - "shortName": "Documents", - "fullName": "google.cloud.dialogflow.v2.Documents" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Documents_ImportDocuments_async", - "title": "dialogflow importDocuments Sample", - "origin": "API_DEFINITION", - "description": " Creates 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. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] - `response`: [ImportDocumentsResponse][google.cloud.dialogflow.v2.ImportDocumentsResponse]", - "canonical": true, - "file": "documents.import_documents.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportDocuments", - "fullName": "google.cloud.dialogflow.v2.Documents.ImportDocuments", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "gcs_source", - "type": ".google.cloud.dialogflow.v2.GcsSources" - }, - { - "name": "document_template", - "type": ".google.cloud.dialogflow.v2.ImportDocumentTemplate" - }, - { - "name": "import_gcs_custom_metadata", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DocumentsClient", - "fullName": "google.cloud.dialogflow.v2.DocumentsClient" - }, - "method": { - "shortName": "ImportDocuments", - "fullName": "google.cloud.dialogflow.v2.Documents.ImportDocuments", - "service": { - "shortName": "Documents", - "fullName": "google.cloud.dialogflow.v2.Documents" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Documents_DeleteDocument_async", - "title": "dialogflow deleteDocument Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified document. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)", - "canonical": true, - "file": "documents.delete_document.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteDocument", - "fullName": "google.cloud.dialogflow.v2.Documents.DeleteDocument", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DocumentsClient", - "fullName": "google.cloud.dialogflow.v2.DocumentsClient" - }, - "method": { - "shortName": "DeleteDocument", - "fullName": "google.cloud.dialogflow.v2.Documents.DeleteDocument", - "service": { - "shortName": "Documents", - "fullName": "google.cloud.dialogflow.v2.Documents" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Documents_UpdateDocument_async", - "title": "dialogflow updateDocument Sample", - "origin": "API_DEFINITION", - "description": " Updates the specified document. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] - `response`: [Document][google.cloud.dialogflow.v2.Document]", - "canonical": true, - "file": "documents.update_document.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateDocument", - "fullName": "google.cloud.dialogflow.v2.Documents.UpdateDocument", - "async": true, - "parameters": [ - { - "name": "document", - "type": ".google.cloud.dialogflow.v2.Document" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DocumentsClient", - "fullName": "google.cloud.dialogflow.v2.DocumentsClient" - }, - "method": { - "shortName": "UpdateDocument", - "fullName": "google.cloud.dialogflow.v2.Documents.UpdateDocument", - "service": { - "shortName": "Documents", - "fullName": "google.cloud.dialogflow.v2.Documents" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Documents_ReloadDocument_async", - "title": "dialogflow reloadDocument Sample", - "origin": "API_DEFINITION", - "description": " 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. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] - `response`: [Document][google.cloud.dialogflow.v2.Document] Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.", - "canonical": true, - "file": "documents.reload_document.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReloadDocument", - "fullName": "google.cloud.dialogflow.v2.Documents.ReloadDocument", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "content_uri", - "type": "TYPE_STRING" - }, - { - "name": "import_gcs_custom_metadata", - "type": "TYPE_BOOL" - }, - { - "name": "smart_messaging_partial_update", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DocumentsClient", - "fullName": "google.cloud.dialogflow.v2.DocumentsClient" - }, - "method": { - "shortName": "ReloadDocument", - "fullName": "google.cloud.dialogflow.v2.Documents.ReloadDocument", - "service": { - "shortName": "Documents", - "fullName": "google.cloud.dialogflow.v2.Documents" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Documents_ExportDocument_async", - "title": "dialogflow exportDocument Sample", - "origin": "API_DEFINITION", - "description": " Exports a smart messaging candidate document into the specified destination. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] - `response`: [Document][google.cloud.dialogflow.v2.Document]", - "canonical": true, - "file": "documents.export_document.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ExportDocument", - "fullName": "google.cloud.dialogflow.v2.Documents.ExportDocument", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "gcs_destination", - "type": ".google.cloud.dialogflow.v2.GcsDestination" - }, - { - "name": "export_full_content", - "type": "TYPE_BOOL" - }, - { - "name": "smart_messaging_partial_update", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DocumentsClient", - "fullName": "google.cloud.dialogflow.v2.DocumentsClient" - }, - "method": { - "shortName": "ExportDocument", - "fullName": "google.cloud.dialogflow.v2.Documents.ExportDocument", - "service": { - "shortName": "Documents", - "fullName": "google.cloud.dialogflow.v2.Documents" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_EntityTypes_ListEntityTypes_async", - "title": "dialogflow listEntityTypes Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of all entity types in the specified agent.", - "canonical": true, - "file": "entity_types.list_entity_types.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListEntityTypes", - "fullName": "google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.ListEntityTypesResponse", - "client": { - "shortName": "EntityTypesClient", - "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" - }, - "method": { - "shortName": "ListEntityTypes", - "fullName": "google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes", - "service": { - "shortName": "EntityTypes", - "fullName": "google.cloud.dialogflow.v2.EntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_EntityTypes_GetEntityType_async", - "title": "dialogflow getEntityType Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the specified entity type.", - "canonical": true, - "file": "entity_types.get_entity_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetEntityType", - "fullName": "google.cloud.dialogflow.v2.EntityTypes.GetEntityType", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.EntityType", - "client": { - "shortName": "EntityTypesClient", - "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" - }, - "method": { - "shortName": "GetEntityType", - "fullName": "google.cloud.dialogflow.v2.EntityTypes.GetEntityType", - "service": { - "shortName": "EntityTypes", - "fullName": "google.cloud.dialogflow.v2.EntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_EntityTypes_CreateEntityType_async", - "title": "dialogflow createEntityType Sample", - "origin": "API_DEFINITION", - "description": " 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).", - "canonical": true, - "file": "entity_types.create_entity_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateEntityType", - "fullName": "google.cloud.dialogflow.v2.EntityTypes.CreateEntityType", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "entity_type", - "type": ".google.cloud.dialogflow.v2.EntityType" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.EntityType", - "client": { - "shortName": "EntityTypesClient", - "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" - }, - "method": { - "shortName": "CreateEntityType", - "fullName": "google.cloud.dialogflow.v2.EntityTypes.CreateEntityType", - "service": { - "shortName": "EntityTypes", - "fullName": "google.cloud.dialogflow.v2.EntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_EntityTypes_UpdateEntityType_async", - "title": "dialogflow updateEntityType Sample", - "origin": "API_DEFINITION", - "description": " 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).", - "canonical": true, - "file": "entity_types.update_entity_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateEntityType", - "fullName": "google.cloud.dialogflow.v2.EntityTypes.UpdateEntityType", - "async": true, - "parameters": [ - { - "name": "entity_type", - "type": ".google.cloud.dialogflow.v2.EntityType" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.dialogflow.v2.EntityType", - "client": { - "shortName": "EntityTypesClient", - "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" - }, - "method": { - "shortName": "UpdateEntityType", - "fullName": "google.cloud.dialogflow.v2.EntityTypes.UpdateEntityType", - "service": { - "shortName": "EntityTypes", - "fullName": "google.cloud.dialogflow.v2.EntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_EntityTypes_DeleteEntityType_async", - "title": "dialogflow deleteEntityType Sample", - "origin": "API_DEFINITION", - "description": " 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).", - "canonical": true, - "file": "entity_types.delete_entity_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteEntityType", - "fullName": "google.cloud.dialogflow.v2.EntityTypes.DeleteEntityType", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "EntityTypesClient", - "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" - }, - "method": { - "shortName": "DeleteEntityType", - "fullName": "google.cloud.dialogflow.v2.EntityTypes.DeleteEntityType", - "service": { - "shortName": "EntityTypes", - "fullName": "google.cloud.dialogflow.v2.EntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_EntityTypes_BatchUpdateEntityTypes_async", - "title": "dialogflow batchUpdateEntityTypes Sample", - "origin": "API_DEFINITION", - "description": " Updates/Creates multiple entity types in the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [BatchUpdateEntityTypesResponse][google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse] Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", - "canonical": true, - "file": "entity_types.batch_update_entity_types.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchUpdateEntityTypes", - "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "entity_type_batch_uri", - "type": "TYPE_STRING" - }, - { - "name": "entity_type_batch_inline", - "type": ".google.cloud.dialogflow.v2.EntityTypeBatch" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "EntityTypesClient", - "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" - }, - "method": { - "shortName": "BatchUpdateEntityTypes", - "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes", - "service": { - "shortName": "EntityTypes", - "fullName": "google.cloud.dialogflow.v2.EntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_EntityTypes_BatchDeleteEntityTypes_async", - "title": "dialogflow batchDeleteEntityTypes Sample", - "origin": "API_DEFINITION", - "description": " Deletes entity types in the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", - "canonical": true, - "file": "entity_types.batch_delete_entity_types.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchDeleteEntityTypes", - "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntityTypes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "entity_type_names", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "EntityTypesClient", - "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" - }, - "method": { - "shortName": "BatchDeleteEntityTypes", - "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntityTypes", - "service": { - "shortName": "EntityTypes", - "fullName": "google.cloud.dialogflow.v2.EntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_EntityTypes_BatchCreateEntities_async", - "title": "dialogflow batchCreateEntities Sample", - "origin": "API_DEFINITION", - "description": " Creates multiple new entities in the specified entity type. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", - "canonical": true, - "file": "entity_types.batch_create_entities.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchCreateEntities", - "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchCreateEntities", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "entities", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "EntityTypesClient", - "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" - }, - "method": { - "shortName": "BatchCreateEntities", - "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchCreateEntities", - "service": { - "shortName": "EntityTypes", - "fullName": "google.cloud.dialogflow.v2.EntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_EntityTypes_BatchUpdateEntities_async", - "title": "dialogflow batchUpdateEntities Sample", - "origin": "API_DEFINITION", - "description": " 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. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", - "canonical": true, - "file": "entity_types.batch_update_entities.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchUpdateEntities", - "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntities", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "entities", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "EntityTypesClient", - "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" - }, - "method": { - "shortName": "BatchUpdateEntities", - "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntities", - "service": { - "shortName": "EntityTypes", - "fullName": "google.cloud.dialogflow.v2.EntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_EntityTypes_BatchDeleteEntities_async", - "title": "dialogflow batchDeleteEntities Sample", - "origin": "API_DEFINITION", - "description": " Deletes entities in the specified entity type. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", - "canonical": true, - "file": "entity_types.batch_delete_entities.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchDeleteEntities", - "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntities", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "entity_values", - "type": "TYPE_STRING[]" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "EntityTypesClient", - "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" - }, - "method": { - "shortName": "BatchDeleteEntities", - "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntities", - "service": { - "shortName": "EntityTypes", - "fullName": "google.cloud.dialogflow.v2.EntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Environments_ListEnvironments_async", - "title": "dialogflow listEnvironments Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of all non-default environments of the specified agent.", - "canonical": true, - "file": "environments.list_environments.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListEnvironments", - "fullName": "google.cloud.dialogflow.v2.Environments.ListEnvironments", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.ListEnvironmentsResponse", - "client": { - "shortName": "EnvironmentsClient", - "fullName": "google.cloud.dialogflow.v2.EnvironmentsClient" - }, - "method": { - "shortName": "ListEnvironments", - "fullName": "google.cloud.dialogflow.v2.Environments.ListEnvironments", - "service": { - "shortName": "Environments", - "fullName": "google.cloud.dialogflow.v2.Environments" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Environments_GetEnvironment_async", - "title": "dialogflow getEnvironment Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the specified agent environment.", - "canonical": true, - "file": "environments.get_environment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetEnvironment", - "fullName": "google.cloud.dialogflow.v2.Environments.GetEnvironment", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.Environment", - "client": { - "shortName": "EnvironmentsClient", - "fullName": "google.cloud.dialogflow.v2.EnvironmentsClient" - }, - "method": { - "shortName": "GetEnvironment", - "fullName": "google.cloud.dialogflow.v2.Environments.GetEnvironment", - "service": { - "shortName": "Environments", - "fullName": "google.cloud.dialogflow.v2.Environments" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Environments_CreateEnvironment_async", - "title": "dialogflow createEnvironment Sample", - "origin": "API_DEFINITION", - "description": " Creates an agent environment.", - "canonical": true, - "file": "environments.create_environment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateEnvironment", - "fullName": "google.cloud.dialogflow.v2.Environments.CreateEnvironment", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "environment", - "type": ".google.cloud.dialogflow.v2.Environment" - }, - { - "name": "environment_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.Environment", - "client": { - "shortName": "EnvironmentsClient", - "fullName": "google.cloud.dialogflow.v2.EnvironmentsClient" - }, - "method": { - "shortName": "CreateEnvironment", - "fullName": "google.cloud.dialogflow.v2.Environments.CreateEnvironment", - "service": { - "shortName": "Environments", - "fullName": "google.cloud.dialogflow.v2.Environments" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Environments_UpdateEnvironment_async", - "title": "dialogflow updateEnvironment Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "environments.update_environment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateEnvironment", - "fullName": "google.cloud.dialogflow.v2.Environments.UpdateEnvironment", - "async": true, - "parameters": [ - { - "name": "environment", - "type": ".google.cloud.dialogflow.v2.Environment" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "allow_load_to_draft_and_discard_changes", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.dialogflow.v2.Environment", - "client": { - "shortName": "EnvironmentsClient", - "fullName": "google.cloud.dialogflow.v2.EnvironmentsClient" - }, - "method": { - "shortName": "UpdateEnvironment", - "fullName": "google.cloud.dialogflow.v2.Environments.UpdateEnvironment", - "service": { - "shortName": "Environments", - "fullName": "google.cloud.dialogflow.v2.Environments" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Environments_DeleteEnvironment_async", - "title": "dialogflow deleteEnvironment Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified agent environment.", - "canonical": true, - "file": "environments.delete_environment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteEnvironment", - "fullName": "google.cloud.dialogflow.v2.Environments.DeleteEnvironment", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "EnvironmentsClient", - "fullName": "google.cloud.dialogflow.v2.EnvironmentsClient" - }, - "method": { - "shortName": "DeleteEnvironment", - "fullName": "google.cloud.dialogflow.v2.Environments.DeleteEnvironment", - "service": { - "shortName": "Environments", - "fullName": "google.cloud.dialogflow.v2.Environments" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Environments_GetEnvironmentHistory_async", - "title": "dialogflow getEnvironmentHistory Sample", - "origin": "API_DEFINITION", - "description": " Gets the history of the specified environment.", - "canonical": true, - "file": "environments.get_environment_history.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetEnvironmentHistory", - "fullName": "google.cloud.dialogflow.v2.Environments.GetEnvironmentHistory", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.EnvironmentHistory", - "client": { - "shortName": "EnvironmentsClient", - "fullName": "google.cloud.dialogflow.v2.EnvironmentsClient" - }, - "method": { - "shortName": "GetEnvironmentHistory", - "fullName": "google.cloud.dialogflow.v2.Environments.GetEnvironmentHistory", - "service": { - "shortName": "Environments", - "fullName": "google.cloud.dialogflow.v2.Environments" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Fulfillments_GetFulfillment_async", - "title": "dialogflow getFulfillment Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the fulfillment.", - "canonical": true, - "file": "fulfillments.get_fulfillment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFulfillment", - "fullName": "google.cloud.dialogflow.v2.Fulfillments.GetFulfillment", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.Fulfillment", - "client": { - "shortName": "FulfillmentsClient", - "fullName": "google.cloud.dialogflow.v2.FulfillmentsClient" - }, - "method": { - "shortName": "GetFulfillment", - "fullName": "google.cloud.dialogflow.v2.Fulfillments.GetFulfillment", - "service": { - "shortName": "Fulfillments", - "fullName": "google.cloud.dialogflow.v2.Fulfillments" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Fulfillments_UpdateFulfillment_async", - "title": "dialogflow updateFulfillment Sample", - "origin": "API_DEFINITION", - "description": " Updates the fulfillment.", - "canonical": true, - "file": "fulfillments.update_fulfillment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateFulfillment", - "fullName": "google.cloud.dialogflow.v2.Fulfillments.UpdateFulfillment", - "async": true, - "parameters": [ - { - "name": "fulfillment", - "type": ".google.cloud.dialogflow.v2.Fulfillment" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.dialogflow.v2.Fulfillment", - "client": { - "shortName": "FulfillmentsClient", - "fullName": "google.cloud.dialogflow.v2.FulfillmentsClient" - }, - "method": { - "shortName": "UpdateFulfillment", - "fullName": "google.cloud.dialogflow.v2.Fulfillments.UpdateFulfillment", - "service": { - "shortName": "Fulfillments", - "fullName": "google.cloud.dialogflow.v2.Fulfillments" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Intents_ListIntents_async", - "title": "dialogflow listIntents Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of all intents in the specified agent.", - "canonical": true, - "file": "intents.list_intents.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListIntents", - "fullName": "google.cloud.dialogflow.v2.Intents.ListIntents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "intent_view", - "type": ".google.cloud.dialogflow.v2.IntentView" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.ListIntentsResponse", - "client": { - "shortName": "IntentsClient", - "fullName": "google.cloud.dialogflow.v2.IntentsClient" - }, - "method": { - "shortName": "ListIntents", - "fullName": "google.cloud.dialogflow.v2.Intents.ListIntents", - "service": { - "shortName": "Intents", - "fullName": "google.cloud.dialogflow.v2.Intents" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Intents_GetIntent_async", - "title": "dialogflow getIntent Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the specified intent.", - "canonical": true, - "file": "intents.get_intent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIntent", - "fullName": "google.cloud.dialogflow.v2.Intents.GetIntent", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "intent_view", - "type": ".google.cloud.dialogflow.v2.IntentView" - } - ], - "resultType": ".google.cloud.dialogflow.v2.Intent", - "client": { - "shortName": "IntentsClient", - "fullName": "google.cloud.dialogflow.v2.IntentsClient" - }, - "method": { - "shortName": "GetIntent", - "fullName": "google.cloud.dialogflow.v2.Intents.GetIntent", - "service": { - "shortName": "Intents", - "fullName": "google.cloud.dialogflow.v2.Intents" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Intents_CreateIntent_async", - "title": "dialogflow createIntent Sample", - "origin": "API_DEFINITION", - "description": " 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).", - "canonical": true, - "file": "intents.create_intent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateIntent", - "fullName": "google.cloud.dialogflow.v2.Intents.CreateIntent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "intent", - "type": ".google.cloud.dialogflow.v2.Intent" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "intent_view", - "type": ".google.cloud.dialogflow.v2.IntentView" - } - ], - "resultType": ".google.cloud.dialogflow.v2.Intent", - "client": { - "shortName": "IntentsClient", - "fullName": "google.cloud.dialogflow.v2.IntentsClient" - }, - "method": { - "shortName": "CreateIntent", - "fullName": "google.cloud.dialogflow.v2.Intents.CreateIntent", - "service": { - "shortName": "Intents", - "fullName": "google.cloud.dialogflow.v2.Intents" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Intents_UpdateIntent_async", - "title": "dialogflow updateIntent Sample", - "origin": "API_DEFINITION", - "description": " 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).", - "canonical": true, - "file": "intents.update_intent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateIntent", - "fullName": "google.cloud.dialogflow.v2.Intents.UpdateIntent", - "async": true, - "parameters": [ - { - "name": "intent", - "type": ".google.cloud.dialogflow.v2.Intent" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "intent_view", - "type": ".google.cloud.dialogflow.v2.IntentView" - } - ], - "resultType": ".google.cloud.dialogflow.v2.Intent", - "client": { - "shortName": "IntentsClient", - "fullName": "google.cloud.dialogflow.v2.IntentsClient" - }, - "method": { - "shortName": "UpdateIntent", - "fullName": "google.cloud.dialogflow.v2.Intents.UpdateIntent", - "service": { - "shortName": "Intents", - "fullName": "google.cloud.dialogflow.v2.Intents" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Intents_DeleteIntent_async", - "title": "dialogflow deleteIntent Sample", - "origin": "API_DEFINITION", - "description": " 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).", - "canonical": true, - "file": "intents.delete_intent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteIntent", - "fullName": "google.cloud.dialogflow.v2.Intents.DeleteIntent", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "IntentsClient", - "fullName": "google.cloud.dialogflow.v2.IntentsClient" - }, - "method": { - "shortName": "DeleteIntent", - "fullName": "google.cloud.dialogflow.v2.Intents.DeleteIntent", - "service": { - "shortName": "Intents", - "fullName": "google.cloud.dialogflow.v2.Intents" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Intents_BatchUpdateIntents_async", - "title": "dialogflow batchUpdateIntents Sample", - "origin": "API_DEFINITION", - "description": " Updates/Creates multiple intents in the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2.BatchUpdateIntentsResponse] Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", - "canonical": true, - "file": "intents.batch_update_intents.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 81, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchUpdateIntents", - "fullName": "google.cloud.dialogflow.v2.Intents.BatchUpdateIntents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "intent_batch_uri", - "type": "TYPE_STRING" - }, - { - "name": "intent_batch_inline", - "type": ".google.cloud.dialogflow.v2.IntentBatch" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "intent_view", - "type": ".google.cloud.dialogflow.v2.IntentView" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "IntentsClient", - "fullName": "google.cloud.dialogflow.v2.IntentsClient" - }, - "method": { - "shortName": "BatchUpdateIntents", - "fullName": "google.cloud.dialogflow.v2.Intents.BatchUpdateIntents", - "service": { - "shortName": "Intents", - "fullName": "google.cloud.dialogflow.v2.Intents" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Intents_BatchDeleteIntents_async", - "title": "dialogflow batchDeleteIntents Sample", - "origin": "API_DEFINITION", - "description": " Deletes intents in the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", - "canonical": true, - "file": "intents.batch_delete_intents.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchDeleteIntents", - "fullName": "google.cloud.dialogflow.v2.Intents.BatchDeleteIntents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "intents", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "IntentsClient", - "fullName": "google.cloud.dialogflow.v2.IntentsClient" - }, - "method": { - "shortName": "BatchDeleteIntents", - "fullName": "google.cloud.dialogflow.v2.Intents.BatchDeleteIntents", - "service": { - "shortName": "Intents", - "fullName": "google.cloud.dialogflow.v2.Intents" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_KnowledgeBases_ListKnowledgeBases_async", - "title": "dialogflow listKnowledgeBases Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of all knowledge bases of the specified agent.", - "canonical": true, - "file": "knowledge_bases.list_knowledge_bases.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 87, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListKnowledgeBases", - "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.ListKnowledgeBases", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.ListKnowledgeBasesResponse", - "client": { - "shortName": "KnowledgeBasesClient", - "fullName": "google.cloud.dialogflow.v2.KnowledgeBasesClient" - }, - "method": { - "shortName": "ListKnowledgeBases", - "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.ListKnowledgeBases", - "service": { - "shortName": "KnowledgeBases", - "fullName": "google.cloud.dialogflow.v2.KnowledgeBases" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_KnowledgeBases_GetKnowledgeBase_async", - "title": "dialogflow getKnowledgeBase Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the specified knowledge base.", - "canonical": true, - "file": "knowledge_bases.get_knowledge_base.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetKnowledgeBase", - "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.GetKnowledgeBase", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.KnowledgeBase", - "client": { - "shortName": "KnowledgeBasesClient", - "fullName": "google.cloud.dialogflow.v2.KnowledgeBasesClient" - }, - "method": { - "shortName": "GetKnowledgeBase", - "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.GetKnowledgeBase", - "service": { - "shortName": "KnowledgeBases", - "fullName": "google.cloud.dialogflow.v2.KnowledgeBases" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_KnowledgeBases_CreateKnowledgeBase_async", - "title": "dialogflow createKnowledgeBase Sample", - "origin": "API_DEFINITION", - "description": " Creates a knowledge base.", - "canonical": true, - "file": "knowledge_bases.create_knowledge_base.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateKnowledgeBase", - "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.CreateKnowledgeBase", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "knowledge_base", - "type": ".google.cloud.dialogflow.v2.KnowledgeBase" - } - ], - "resultType": ".google.cloud.dialogflow.v2.KnowledgeBase", - "client": { - "shortName": "KnowledgeBasesClient", - "fullName": "google.cloud.dialogflow.v2.KnowledgeBasesClient" - }, - "method": { - "shortName": "CreateKnowledgeBase", - "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.CreateKnowledgeBase", - "service": { - "shortName": "KnowledgeBases", - "fullName": "google.cloud.dialogflow.v2.KnowledgeBases" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_KnowledgeBases_DeleteKnowledgeBase_async", - "title": "dialogflow deleteKnowledgeBase Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified knowledge base.", - "canonical": true, - "file": "knowledge_bases.delete_knowledge_base.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteKnowledgeBase", - "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.DeleteKnowledgeBase", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "KnowledgeBasesClient", - "fullName": "google.cloud.dialogflow.v2.KnowledgeBasesClient" - }, - "method": { - "shortName": "DeleteKnowledgeBase", - "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.DeleteKnowledgeBase", - "service": { - "shortName": "KnowledgeBases", - "fullName": "google.cloud.dialogflow.v2.KnowledgeBases" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_KnowledgeBases_UpdateKnowledgeBase_async", - "title": "dialogflow updateKnowledgeBase Sample", - "origin": "API_DEFINITION", - "description": " Updates the specified knowledge base.", - "canonical": true, - "file": "knowledge_bases.update_knowledge_base.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateKnowledgeBase", - "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.UpdateKnowledgeBase", - "async": true, - "parameters": [ - { - "name": "knowledge_base", - "type": ".google.cloud.dialogflow.v2.KnowledgeBase" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.dialogflow.v2.KnowledgeBase", - "client": { - "shortName": "KnowledgeBasesClient", - "fullName": "google.cloud.dialogflow.v2.KnowledgeBasesClient" - }, - "method": { - "shortName": "UpdateKnowledgeBase", - "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.UpdateKnowledgeBase", - "service": { - "shortName": "KnowledgeBases", - "fullName": "google.cloud.dialogflow.v2.KnowledgeBases" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Participants_CreateParticipant_async", - "title": "dialogflow createParticipant Sample", - "origin": "API_DEFINITION", - "description": " Creates a new participant in a conversation.", - "canonical": true, - "file": "participants.create_participant.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateParticipant", - "fullName": "google.cloud.dialogflow.v2.Participants.CreateParticipant", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "participant", - "type": ".google.cloud.dialogflow.v2.Participant" - } - ], - "resultType": ".google.cloud.dialogflow.v2.Participant", - "client": { - "shortName": "ParticipantsClient", - "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" - }, - "method": { - "shortName": "CreateParticipant", - "fullName": "google.cloud.dialogflow.v2.Participants.CreateParticipant", - "service": { - "shortName": "Participants", - "fullName": "google.cloud.dialogflow.v2.Participants" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Participants_GetParticipant_async", - "title": "dialogflow getParticipant Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a conversation participant.", - "canonical": true, - "file": "participants.get_participant.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetParticipant", - "fullName": "google.cloud.dialogflow.v2.Participants.GetParticipant", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.Participant", - "client": { - "shortName": "ParticipantsClient", - "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" - }, - "method": { - "shortName": "GetParticipant", - "fullName": "google.cloud.dialogflow.v2.Participants.GetParticipant", - "service": { - "shortName": "Participants", - "fullName": "google.cloud.dialogflow.v2.Participants" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Participants_ListParticipants_async", - "title": "dialogflow listParticipants Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of all participants in the specified conversation.", - "canonical": true, - "file": "participants.list_participants.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListParticipants", - "fullName": "google.cloud.dialogflow.v2.Participants.ListParticipants", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.ListParticipantsResponse", - "client": { - "shortName": "ParticipantsClient", - "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" - }, - "method": { - "shortName": "ListParticipants", - "fullName": "google.cloud.dialogflow.v2.Participants.ListParticipants", - "service": { - "shortName": "Participants", - "fullName": "google.cloud.dialogflow.v2.Participants" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Participants_UpdateParticipant_async", - "title": "dialogflow updateParticipant Sample", - "origin": "API_DEFINITION", - "description": " Updates the specified participant.", - "canonical": true, - "file": "participants.update_participant.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateParticipant", - "fullName": "google.cloud.dialogflow.v2.Participants.UpdateParticipant", - "async": true, - "parameters": [ - { - "name": "participant", - "type": ".google.cloud.dialogflow.v2.Participant" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.dialogflow.v2.Participant", - "client": { - "shortName": "ParticipantsClient", - "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" - }, - "method": { - "shortName": "UpdateParticipant", - "fullName": "google.cloud.dialogflow.v2.Participants.UpdateParticipant", - "service": { - "shortName": "Participants", - "fullName": "google.cloud.dialogflow.v2.Participants" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Participants_AnalyzeContent_async", - "title": "dialogflow analyzeContent Sample", - "origin": "API_DEFINITION", - "description": " 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).", - "canonical": true, - "file": "participants.analyze_content.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 93, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AnalyzeContent", - "fullName": "google.cloud.dialogflow.v2.Participants.AnalyzeContent", - "async": true, - "parameters": [ - { - "name": "participant", - "type": "TYPE_STRING" - }, - { - "name": "text_input", - "type": ".google.cloud.dialogflow.v2.TextInput" - }, - { - "name": "event_input", - "type": ".google.cloud.dialogflow.v2.EventInput" - }, - { - "name": "reply_audio_config", - "type": ".google.cloud.dialogflow.v2.OutputAudioConfig" - }, - { - "name": "query_params", - "type": ".google.cloud.dialogflow.v2.QueryParameters" - }, - { - "name": "assist_query_params", - "type": ".google.cloud.dialogflow.v2.AssistQueryParameters" - }, - { - "name": "cx_parameters", - "type": ".google.protobuf.Struct" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.AnalyzeContentResponse", - "client": { - "shortName": "ParticipantsClient", - "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" - }, - "method": { - "shortName": "AnalyzeContent", - "fullName": "google.cloud.dialogflow.v2.Participants.AnalyzeContent", - "service": { - "shortName": "Participants", - "fullName": "google.cloud.dialogflow.v2.Participants" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Participants_StreamingAnalyzeContent_async", - "title": "dialogflow streamingAnalyzeContent Sample", - "origin": "API_DEFINITION", - "description": " Adds a text (chat, for example), or audio (phone recording, for example) message from a participant into the conversation. Note: This method is only available through the gRPC API (not REST). The top-level message sent to the client by the server is `StreamingAnalyzeContentResponse`. Multiple response messages can be returned in order. The first one or more messages contain the `recognition_result` field. Each result represents a more complete transcript of what the user said. The next message contains the `reply_text` field and potentially the `reply_audio` field. The message can also contain the `automated_agent_reply` field. 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).", - "canonical": true, - "file": "participants.streaming_analyze_content.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 117, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StreamingAnalyzeContent", - "fullName": "google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent", - "async": true, - "parameters": [ - { - "name": "participant", - "type": "TYPE_STRING" - }, - { - "name": "audio_config", - "type": ".google.cloud.dialogflow.v2.InputAudioConfig" - }, - { - "name": "text_config", - "type": ".google.cloud.dialogflow.v2.InputTextConfig" - }, - { - "name": "reply_audio_config", - "type": ".google.cloud.dialogflow.v2.OutputAudioConfig" - }, - { - "name": "input_audio", - "type": "TYPE_BYTES" - }, - { - "name": "input_text", - "type": "TYPE_STRING" - }, - { - "name": "input_dtmf", - "type": ".google.cloud.dialogflow.v2.TelephonyDtmfEvents" - }, - { - "name": "query_params", - "type": ".google.cloud.dialogflow.v2.QueryParameters" - }, - { - "name": "assist_query_params", - "type": ".google.cloud.dialogflow.v2.AssistQueryParameters" - }, - { - "name": "cx_parameters", - "type": ".google.protobuf.Struct" - }, - { - "name": "enable_partial_automated_agent_reply", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse", - "client": { - "shortName": "ParticipantsClient", - "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" - }, - "method": { - "shortName": "StreamingAnalyzeContent", - "fullName": "google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent", - "service": { - "shortName": "Participants", - "fullName": "google.cloud.dialogflow.v2.Participants" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Participants_SuggestArticles_async", - "title": "dialogflow suggestArticles Sample", - "origin": "API_DEFINITION", - "description": " Gets suggested articles for a participant based on specific historical messages.", - "canonical": true, - "file": "participants.suggest_articles.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SuggestArticles", - "fullName": "google.cloud.dialogflow.v2.Participants.SuggestArticles", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "latest_message", - "type": "TYPE_STRING" - }, - { - "name": "context_size", - "type": "TYPE_INT32" - }, - { - "name": "assist_query_params", - "type": ".google.cloud.dialogflow.v2.AssistQueryParameters" - } - ], - "resultType": ".google.cloud.dialogflow.v2.SuggestArticlesResponse", - "client": { - "shortName": "ParticipantsClient", - "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" - }, - "method": { - "shortName": "SuggestArticles", - "fullName": "google.cloud.dialogflow.v2.Participants.SuggestArticles", - "service": { - "shortName": "Participants", - "fullName": "google.cloud.dialogflow.v2.Participants" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Participants_SuggestFaqAnswers_async", - "title": "dialogflow suggestFaqAnswers Sample", - "origin": "API_DEFINITION", - "description": " Gets suggested faq answers for a participant based on specific historical messages.", - "canonical": true, - "file": "participants.suggest_faq_answers.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SuggestFaqAnswers", - "fullName": "google.cloud.dialogflow.v2.Participants.SuggestFaqAnswers", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "latest_message", - "type": "TYPE_STRING" - }, - { - "name": "context_size", - "type": "TYPE_INT32" - }, - { - "name": "assist_query_params", - "type": ".google.cloud.dialogflow.v2.AssistQueryParameters" - } - ], - "resultType": ".google.cloud.dialogflow.v2.SuggestFaqAnswersResponse", - "client": { - "shortName": "ParticipantsClient", - "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" - }, - "method": { - "shortName": "SuggestFaqAnswers", - "fullName": "google.cloud.dialogflow.v2.Participants.SuggestFaqAnswers", - "service": { - "shortName": "Participants", - "fullName": "google.cloud.dialogflow.v2.Participants" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Participants_SuggestSmartReplies_async", - "title": "dialogflow suggestSmartReplies Sample", - "origin": "API_DEFINITION", - "description": " Gets smart replies for a participant based on specific historical messages.", - "canonical": true, - "file": "participants.suggest_smart_replies.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SuggestSmartReplies", - "fullName": "google.cloud.dialogflow.v2.Participants.SuggestSmartReplies", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "current_text_input", - "type": ".google.cloud.dialogflow.v2.TextInput" - }, - { - "name": "latest_message", - "type": "TYPE_STRING" - }, - { - "name": "context_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.dialogflow.v2.SuggestSmartRepliesResponse", - "client": { - "shortName": "ParticipantsClient", - "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" - }, - "method": { - "shortName": "SuggestSmartReplies", - "fullName": "google.cloud.dialogflow.v2.Participants.SuggestSmartReplies", - "service": { - "shortName": "Participants", - "fullName": "google.cloud.dialogflow.v2.Participants" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_SessionEntityTypes_ListSessionEntityTypes_async", - "title": "dialogflow listSessionEntityTypes Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "session_entity_types.list_session_entity_types.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSessionEntityTypes", - "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.ListSessionEntityTypesResponse", - "client": { - "shortName": "SessionEntityTypesClient", - "fullName": "google.cloud.dialogflow.v2.SessionEntityTypesClient" - }, - "method": { - "shortName": "ListSessionEntityTypes", - "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes", - "service": { - "shortName": "SessionEntityTypes", - "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_SessionEntityTypes_GetSessionEntityType_async", - "title": "dialogflow getSessionEntityType Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "session_entity_types.get_session_entity_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSessionEntityType", - "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.GetSessionEntityType", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.SessionEntityType", - "client": { - "shortName": "SessionEntityTypesClient", - "fullName": "google.cloud.dialogflow.v2.SessionEntityTypesClient" - }, - "method": { - "shortName": "GetSessionEntityType", - "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.GetSessionEntityType", - "service": { - "shortName": "SessionEntityTypes", - "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_SessionEntityTypes_CreateSessionEntityType_async", - "title": "dialogflow createSessionEntityType Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "session_entity_types.create_session_entity_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateSessionEntityType", - "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.CreateSessionEntityType", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "session_entity_type", - "type": ".google.cloud.dialogflow.v2.SessionEntityType" - } - ], - "resultType": ".google.cloud.dialogflow.v2.SessionEntityType", - "client": { - "shortName": "SessionEntityTypesClient", - "fullName": "google.cloud.dialogflow.v2.SessionEntityTypesClient" - }, - "method": { - "shortName": "CreateSessionEntityType", - "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.CreateSessionEntityType", - "service": { - "shortName": "SessionEntityTypes", - "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_SessionEntityTypes_UpdateSessionEntityType_async", - "title": "dialogflow updateSessionEntityType Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "session_entity_types.update_session_entity_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSessionEntityType", - "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.UpdateSessionEntityType", - "async": true, - "parameters": [ - { - "name": "session_entity_type", - "type": ".google.cloud.dialogflow.v2.SessionEntityType" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.dialogflow.v2.SessionEntityType", - "client": { - "shortName": "SessionEntityTypesClient", - "fullName": "google.cloud.dialogflow.v2.SessionEntityTypesClient" - }, - "method": { - "shortName": "UpdateSessionEntityType", - "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.UpdateSessionEntityType", - "service": { - "shortName": "SessionEntityTypes", - "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_SessionEntityTypes_DeleteSessionEntityType_async", - "title": "dialogflow deleteSessionEntityType Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "session_entity_types.delete_session_entity_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteSessionEntityType", - "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.DeleteSessionEntityType", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "SessionEntityTypesClient", - "fullName": "google.cloud.dialogflow.v2.SessionEntityTypesClient" - }, - "method": { - "shortName": "DeleteSessionEntityType", - "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.DeleteSessionEntityType", - "service": { - "shortName": "SessionEntityTypes", - "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Sessions_DetectIntent_async", - "title": "dialogflow detectIntent Sample", - "origin": "API_DEFINITION", - "description": " 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. If you might use [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) or other CCAI products now or in the future, consider using [AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] instead of `DetectIntent`. `AnalyzeContent` has additional functionality for Agent Assist and other CCAI products. Note: Always use agent versions for production traffic. See [Versions and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).", - "canonical": true, - "file": "sessions.detect_intent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 100, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DetectIntent", - "fullName": "google.cloud.dialogflow.v2.Sessions.DetectIntent", - "async": true, - "parameters": [ - { - "name": "session", - "type": "TYPE_STRING" - }, - { - "name": "query_params", - "type": ".google.cloud.dialogflow.v2.QueryParameters" - }, - { - "name": "query_input", - "type": ".google.cloud.dialogflow.v2.QueryInput" - }, - { - "name": "output_audio_config", - "type": ".google.cloud.dialogflow.v2.OutputAudioConfig" - }, - { - "name": "output_audio_config_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "input_audio", - "type": "TYPE_BYTES" - } - ], - "resultType": ".google.cloud.dialogflow.v2.DetectIntentResponse", - "client": { - "shortName": "SessionsClient", - "fullName": "google.cloud.dialogflow.v2.SessionsClient" - }, - "method": { - "shortName": "DetectIntent", - "fullName": "google.cloud.dialogflow.v2.Sessions.DetectIntent", - "service": { - "shortName": "Sessions", - "fullName": "google.cloud.dialogflow.v2.Sessions" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Sessions_StreamingDetectIntent_async", - "title": "dialogflow streamingDetectIntent Sample", - "origin": "API_DEFINITION", - "description": " 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). If you might use [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) or other CCAI products now or in the future, consider using [StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent] instead of `StreamingDetectIntent`. `StreamingAnalyzeContent` has additional functionality for Agent Assist and other CCAI products. Note: Always use agent versions for production traffic. See [Versions and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).", - "canonical": true, - "file": "sessions.streaming_detect_intent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 115, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StreamingDetectIntent", - "fullName": "google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent", - "async": true, - "parameters": [ - { - "name": "session", - "type": "TYPE_STRING" - }, - { - "name": "query_params", - "type": ".google.cloud.dialogflow.v2.QueryParameters" - }, - { - "name": "query_input", - "type": ".google.cloud.dialogflow.v2.QueryInput" - }, - { - "name": "single_utterance", - "type": "TYPE_BOOL" - }, - { - "name": "output_audio_config", - "type": ".google.cloud.dialogflow.v2.OutputAudioConfig" - }, - { - "name": "output_audio_config_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "input_audio", - "type": "TYPE_BYTES" - } - ], - "resultType": ".google.cloud.dialogflow.v2.StreamingDetectIntentResponse", - "client": { - "shortName": "SessionsClient", - "fullName": "google.cloud.dialogflow.v2.SessionsClient" - }, - "method": { - "shortName": "StreamingDetectIntent", - "fullName": "google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent", - "service": { - "shortName": "Sessions", - "fullName": "google.cloud.dialogflow.v2.Sessions" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Versions_ListVersions_async", - "title": "dialogflow listVersions Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of all versions of the specified agent.", - "canonical": true, - "file": "versions.list_versions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListVersions", - "fullName": "google.cloud.dialogflow.v2.Versions.ListVersions", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.ListVersionsResponse", - "client": { - "shortName": "VersionsClient", - "fullName": "google.cloud.dialogflow.v2.VersionsClient" - }, - "method": { - "shortName": "ListVersions", - "fullName": "google.cloud.dialogflow.v2.Versions.ListVersions", - "service": { - "shortName": "Versions", - "fullName": "google.cloud.dialogflow.v2.Versions" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Versions_GetVersion_async", - "title": "dialogflow getVersion Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the specified agent version.", - "canonical": true, - "file": "versions.get_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetVersion", - "fullName": "google.cloud.dialogflow.v2.Versions.GetVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2.Version", - "client": { - "shortName": "VersionsClient", - "fullName": "google.cloud.dialogflow.v2.VersionsClient" - }, - "method": { - "shortName": "GetVersion", - "fullName": "google.cloud.dialogflow.v2.Versions.GetVersion", - "service": { - "shortName": "Versions", - "fullName": "google.cloud.dialogflow.v2.Versions" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Versions_CreateVersion_async", - "title": "dialogflow createVersion Sample", - "origin": "API_DEFINITION", - "description": " Creates an agent version. The new version points to the agent instance in the \"default\" environment.", - "canonical": true, - "file": "versions.create_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateVersion", - "fullName": "google.cloud.dialogflow.v2.Versions.CreateVersion", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "version", - "type": ".google.cloud.dialogflow.v2.Version" - } - ], - "resultType": ".google.cloud.dialogflow.v2.Version", - "client": { - "shortName": "VersionsClient", - "fullName": "google.cloud.dialogflow.v2.VersionsClient" - }, - "method": { - "shortName": "CreateVersion", - "fullName": "google.cloud.dialogflow.v2.Versions.CreateVersion", - "service": { - "shortName": "Versions", - "fullName": "google.cloud.dialogflow.v2.Versions" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Versions_UpdateVersion_async", - "title": "dialogflow updateVersion Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "versions.update_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateVersion", - "fullName": "google.cloud.dialogflow.v2.Versions.UpdateVersion", - "async": true, - "parameters": [ - { - "name": "version", - "type": ".google.cloud.dialogflow.v2.Version" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.dialogflow.v2.Version", - "client": { - "shortName": "VersionsClient", - "fullName": "google.cloud.dialogflow.v2.VersionsClient" - }, - "method": { - "shortName": "UpdateVersion", - "fullName": "google.cloud.dialogflow.v2.Versions.UpdateVersion", - "service": { - "shortName": "Versions", - "fullName": "google.cloud.dialogflow.v2.Versions" - } - } - } - }, - { - "regionTag": "dialogflow_v2_generated_Versions_DeleteVersion_async", - "title": "dialogflow deleteVersion Sample", - "origin": "API_DEFINITION", - "description": " Delete the specified agent version.", - "canonical": true, - "file": "versions.delete_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteVersion", - "fullName": "google.cloud.dialogflow.v2.Versions.DeleteVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "VersionsClient", - "fullName": "google.cloud.dialogflow.v2.VersionsClient" - }, - "method": { - "shortName": "DeleteVersion", - "fullName": "google.cloud.dialogflow.v2.Versions.DeleteVersion", - "service": { - "shortName": "Versions", - "fullName": "google.cloud.dialogflow.v2.Versions" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.create_version.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.create_version.js deleted file mode 100644 index f67e4e95493..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.create_version.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, version) { - // [START dialogflow_v2_generated_Versions_CreateVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The agent to create a version for. - * Supported formats: - * - `projects//agent` - * - `projects//locations//agent` - */ - // const parent = 'abc123' - /** - * Required. The version to create. - */ - // const version = {} - - // Imports the Dialogflow library - const {VersionsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new VersionsClient(); - - async function callCreateVersion() { - // Construct request - const request = { - parent, - version, - }; - - // Run request - const response = await dialogflowClient.createVersion(request); - console.log(response); - } - - callCreateVersion(); - // [END dialogflow_v2_generated_Versions_CreateVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.delete_version.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.delete_version.js deleted file mode 100644 index d087ace525f..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.delete_version.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_Versions_DeleteVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the version to delete. - * Supported formats: - * - `projects//agent/versions/` - * - `projects//locations//agent/versions/` - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {VersionsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new VersionsClient(); - - async function callDeleteVersion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.deleteVersion(request); - console.log(response); - } - - callDeleteVersion(); - // [END dialogflow_v2_generated_Versions_DeleteVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.get_version.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.get_version.js deleted file mode 100644 index ad84c7c82ff..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.get_version.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2_generated_Versions_GetVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the version. - * Supported formats: - * - `projects//agent/versions/` - * - `projects//locations//agent/versions/` - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {VersionsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new VersionsClient(); - - async function callGetVersion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getVersion(request); - console.log(response); - } - - callGetVersion(); - // [END dialogflow_v2_generated_Versions_GetVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.list_versions.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.list_versions.js deleted file mode 100644 index 15e8e1e850d..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.list_versions.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2_generated_Versions_ListVersions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The agent to list all versions from. - * Supported formats: - * - `projects//agent` - * - `projects//locations//agent` - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of items to return in a single page. By default 100 and - * at most 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {VersionsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new VersionsClient(); - - async function callListVersions() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listVersionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListVersions(); - // [END dialogflow_v2_generated_Versions_ListVersions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.update_version.js b/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.update_version.js deleted file mode 100644 index ee0e78f352a..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/samples/generated/v2/versions.update_version.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2022 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'; - -function main(version, updateMask) { - // [START dialogflow_v2_generated_Versions_UpdateVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The version to update. - * Supported formats: - * - `projects//agent/versions/` - * - `projects//locations//agent/versions/` - */ - // const version = {} - /** - * Required. The mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {VersionsClient} = require('@google-cloud/dialogflow').v2; - - // Instantiates a client - const dialogflowClient = new VersionsClient(); - - async function callUpdateVersion() { - // Construct request - const request = { - version, - updateMask, - }; - - // Run request - const response = await dialogflowClient.updateVersion(request); - console.log(response); - } - - callUpdateVersion(); - // [END dialogflow_v2_generated_Versions_UpdateVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/index.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/index.ts deleted file mode 100644 index 67bff590c9f..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/index.ts +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2022 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 ConversationDatasetsClient = v2.ConversationDatasetsClient; -type ConversationDatasetsClient = v2.ConversationDatasetsClient; -const ConversationModelsClient = v2.ConversationModelsClient; -type ConversationModelsClient = v2.ConversationModelsClient; -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, ConversationDatasetsClient, ConversationModelsClient, ConversationProfilesClient, ConversationsClient, DocumentsClient, EntityTypesClient, EnvironmentsClient, FulfillmentsClient, IntentsClient, KnowledgeBasesClient, ParticipantsClient, SessionEntityTypesClient, SessionsClient, VersionsClient}; -export default {v2, AgentsClient, AnswerRecordsClient, ContextsClient, ConversationDatasetsClient, ConversationModelsClient, 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/google-cloud-dialogflow/v2/src/v2/agents_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/agents_client.ts deleted file mode 100644 index 672437a3764..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/agents_client.ts +++ /dev/null @@ -1,3664 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -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'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new AgentsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = { - conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' - ), - 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}' - ), - projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}' - ), - projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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}' - ), - projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' - ), - projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2/{name=projects/*/operations/*}:cancel',additional_bindings: [{post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=projects/*/operations/*}',additional_bindings: [{get: '/v2/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2/{name=projects/*}/operations',additional_bindings: [{get: '/v2/{name=projects/*/locations/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).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 = this._gaxModule.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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2/agents.get_agent.js - * region_tag:dialogflow_v2_generated_Agents_GetAgent_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.getAgent(request, options, callback); - } -/** - * 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 include:samples/generated/v2/agents.set_agent.js - * region_tag:dialogflow_v2_generated_Agents_SetAgent_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'agent.parent': request.agent!.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.setAgent(request, options, callback); - } -/** - * 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 include:samples/generated/v2/agents.delete_agent.js - * region_tag:dialogflow_v2_generated_Agents_DeleteAgent_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteAgent(request, options, callback); - } -/** - * 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 include:samples/generated/v2/agents.get_validation_result.js - * region_tag:dialogflow_v2_generated_Agents_GetValidationResult_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.getValidationResult(request, options, callback); - } - -/** - * Trains the specified agent. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: An empty [Struct - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - * - `response`: An [Empty - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - * - * 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 include:samples/generated/v2/agents.train_agent.js - * region_tag:dialogflow_v2_generated_Agents_TrainAgent_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2/agents.train_agent.js - * region_tag:dialogflow_v2_generated_Agents_TrainAgent_async - */ - async checkTrainAgentProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.trainAgent, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Exports the specified agent to a ZIP file. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: An empty [Struct - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - * - `response`: {@link google.cloud.dialogflow.v2.ExportAgentResponse|ExportAgentResponse} - * - * @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. - * - * Dialogflow performs a write operation for the Cloud Storage object - * on the caller's behalf, so your request authentication must - * have write permissions for the object. For more information, see - * [Dialogflow access - * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2/agents.export_agent.js - * region_tag:dialogflow_v2_generated_Agents_ExportAgent_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2/agents.export_agent.js - * region_tag:dialogflow_v2_generated_Agents_ExportAgent_async - */ - async checkExportAgentProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportAgent, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * 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. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: An empty [Struct - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - * - `response`: An [Empty - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - * - * The operation only tracks when importing is complete, 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://". - * - * Dialogflow performs a read operation for the Cloud Storage object - * on the caller's behalf, so your request authentication must - * have read permissions for the object. For more information, see - * [Dialogflow access - * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). - * @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 include:samples/generated/v2/agents.import_agent.js - * region_tag:dialogflow_v2_generated_Agents_ImportAgent_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2/agents.import_agent.js - * region_tag:dialogflow_v2_generated_Agents_ImportAgent_async - */ - async checkImportAgentProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importAgent, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * 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. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: An empty [Struct - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - * - `response`: An [Empty - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - * - * The operation only tracks when restoring is complete, 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://". - * - * Dialogflow performs a read operation for the Cloud Storage object - * on the caller's behalf, so your request authentication must - * have read permissions for the object. For more information, see - * [Dialogflow access - * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). - * @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 include:samples/generated/v2/agents.restore_agent.js - * region_tag:dialogflow_v2_generated_Agents_RestoreAgent_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2/agents.restore_agent.js - * region_tag:dialogflow_v2_generated_Agents_RestoreAgent_async - */ - async checkRestoreAgentProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.restoreAgent, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['searchAgents']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.searchAgents.createStream( - this.innerApiCalls.searchAgents as 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 include:samples/generated/v2/agents.search_agents.js - * region_tag:dialogflow_v2_generated_Agents_SearchAgents_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['searchAgents']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.searchAgents.asyncIterate( - this.innerApiCalls['searchAgents'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. The promise has a method named - * "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified conversationDataset resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_dataset - * @returns {string} Resource name string. - */ - conversationDatasetPath(project:string,location:string,conversationDataset:string) { - return this.pathTemplates.conversationDatasetPathTemplate.render({ - project: project, - location: location, - conversation_dataset: conversationDataset, - }); - } - - /** - * Parse the project from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; - } - - /** - * Parse the location from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; - } - - /** - * Parse the conversation_dataset from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the conversation_dataset. - */ - matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; - } - - /** - * 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 projectConversationModel resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectConversationModelPath(project:string,conversationModel:string) { - return this.pathTemplates.projectConversationModelPathTemplate.render({ - project: project, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ - project: project, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; - } - - /** - * 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 projectLocationConversationModel resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; - } - - /** - * Parse the location from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; - } - - /** - * Parse the location from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; - } - - /** - * 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 { - if (this.agentsStub && !this._terminated) { - return this.agentsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/agents_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/agents_client_config.json deleted file mode 100644 index 93d6e00d8f9..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/src/v2/agents_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/agents_proto_list.json deleted file mode 100644 index 15e06b6def0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/agents_proto_list.json +++ /dev/null @@ -1,25 +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_dataset.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/answer_records_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/answer_records_client.ts deleted file mode 100644 index 8f99e13cae2..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/answer_records_client.ts +++ /dev/null @@ -1,2767 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new AnswerRecordsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = { - conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' - ), - 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}' - ), - projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}' - ), - projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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}' - ), - projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' - ), - projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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 = this._gaxModule.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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2/answer_records.update_answer_record.js - * region_tag:dialogflow_v2_generated_AnswerRecords_UpdateAnswerRecord_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'answer_record.name': request.answerRecord!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateAnswerRecord(request, options, callback); - } - - /** - * 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] - * Optional. Filters to restrict results to specific answer records. - * - * Marked deprecated as it hasn't been, and isn't currently, supported. - * - * 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, - 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; - 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' - ] = this._gaxModule.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] - * Optional. Filters to restrict results to specific answer records. - * - * Marked deprecated as it hasn't been, and isn't currently, supported. - * - * 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listAnswerRecords']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAnswerRecords.createStream( - this.innerApiCalls.listAnswerRecords as 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] - * Optional. Filters to restrict results to specific answer records. - * - * Marked deprecated as it hasn't been, and isn't currently, supported. - * - * 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 include:samples/generated/v2/answer_records.list_answer_records.js - * region_tag:dialogflow_v2_generated_AnswerRecords_ListAnswerRecords_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listAnswerRecords']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAnswerRecords.asyncIterate( - this.innerApiCalls['listAnswerRecords'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified conversationDataset resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_dataset - * @returns {string} Resource name string. - */ - conversationDatasetPath(project:string,location:string,conversationDataset:string) { - return this.pathTemplates.conversationDatasetPathTemplate.render({ - project: project, - location: location, - conversation_dataset: conversationDataset, - }); - } - - /** - * Parse the project from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; - } - - /** - * Parse the location from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; - } - - /** - * Parse the conversation_dataset from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the conversation_dataset. - */ - matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; - } - - /** - * 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 projectConversationModel resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectConversationModelPath(project:string,conversationModel:string) { - return this.pathTemplates.projectConversationModelPathTemplate.render({ - project: project, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ - project: project, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; - } - - /** - * 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 projectLocationConversationModel resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; - } - - /** - * Parse the location from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; - } - - /** - * Parse the location from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; - } - - /** - * 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 { - if (this.answerRecordsStub && !this._terminated) { - return this.answerRecordsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/answer_records_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/answer_records_client_config.json deleted file mode 100644 index cc29e1ea884..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/src/v2/answer_records_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/answer_records_proto_list.json deleted file mode 100644 index 15e06b6def0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/answer_records_proto_list.json +++ /dev/null @@ -1,25 +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_dataset.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/contexts_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/contexts_client.ts deleted file mode 100644 index 949503b0f12..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/contexts_client.ts +++ /dev/null @@ -1,3089 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new ContextsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = { - conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' - ), - 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}' - ), - projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}' - ), - projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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}' - ), - projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' - ), - projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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 = this._gaxModule.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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2/contexts.get_context.js - * region_tag:dialogflow_v2_generated_Contexts_GetContext_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getContext(request, options, callback); - } -/** - * 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 include:samples/generated/v2/contexts.create_context.js - * region_tag:dialogflow_v2_generated_Contexts_CreateContext_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createContext(request, options, callback); - } -/** - * 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 include:samples/generated/v2/contexts.update_context.js - * region_tag:dialogflow_v2_generated_Contexts_UpdateContext_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'context.name': request.context!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateContext(request, options, callback); - } -/** - * Deletes the specified context. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the context to delete. Format: - * `projects//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 include:samples/generated/v2/contexts.delete_context.js - * region_tag:dialogflow_v2_generated_Contexts_DeleteContext_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteContext(request, options, callback); - } -/** - * Deletes all active contexts in the specified session. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the session to delete all contexts from. Format: - * `projects//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 include:samples/generated/v2/contexts.delete_all_contexts.js - * region_tag:dialogflow_v2_generated_Contexts_DeleteAllContexts_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteAllContexts(request, options, callback); - } - - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listContexts']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listContexts.createStream( - this.innerApiCalls.listContexts as 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 include:samples/generated/v2/contexts.list_contexts.js - * region_tag:dialogflow_v2_generated_Contexts_ListContexts_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listContexts']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listContexts.asyncIterate( - this.innerApiCalls['listContexts'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified conversationDataset resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_dataset - * @returns {string} Resource name string. - */ - conversationDatasetPath(project:string,location:string,conversationDataset:string) { - return this.pathTemplates.conversationDatasetPathTemplate.render({ - project: project, - location: location, - conversation_dataset: conversationDataset, - }); - } - - /** - * Parse the project from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; - } - - /** - * Parse the location from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; - } - - /** - * Parse the conversation_dataset from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the conversation_dataset. - */ - matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; - } - - /** - * 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 projectConversationModel resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectConversationModelPath(project:string,conversationModel:string) { - return this.pathTemplates.projectConversationModelPathTemplate.render({ - project: project, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ - project: project, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; - } - - /** - * 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 projectLocationConversationModel resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; - } - - /** - * Parse the location from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; - } - - /** - * Parse the location from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; - } - - /** - * 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 { - if (this.contextsStub && !this._terminated) { - return this.contextsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/contexts_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/contexts_client_config.json deleted file mode 100644 index c44e6aaa4fb..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/src/v2/contexts_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/contexts_proto_list.json deleted file mode 100644 index 15e06b6def0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/contexts_proto_list.json +++ /dev/null @@ -1,25 +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_dataset.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/conversation_datasets_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_datasets_client.ts deleted file mode 100644 index 2b77045bdb4..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_datasets_client.ts +++ /dev/null @@ -1,3303 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/conversation_datasets_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './conversation_datasets_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Conversation datasets. - * - * Conversation datasets contain raw conversation files and their - * customizable metadata that can be used for model training. - * @class - * @memberof v2 - */ -export class ConversationDatasetsClient { - 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}; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - conversationDatasetsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ConversationDatasetsClient. - * - * @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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new ConversationDatasetsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ConversationDatasetsClient; - 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = { - conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - 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}' - ), - projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}' - ), - projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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}' - ), - projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' - ), - projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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 = { - listConversationDatasets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'conversationDatasets') - }; - - 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. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2/{name=projects/*/operations/*}:cancel',additional_bindings: [{post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=projects/*/operations/*}',additional_bindings: [{get: '/v2/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2/{name=projects/*}/operations',additional_bindings: [{get: '/v2/{name=projects/*/locations/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createConversationDatasetResponse = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.ConversationDataset') as gax.protobuf.Type; - const createConversationDatasetMetadata = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata') as gax.protobuf.Type; - const deleteConversationDatasetResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteConversationDatasetMetadata = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata') as gax.protobuf.Type; - const importConversationDataResponse = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.ImportConversationDataOperationResponse') as gax.protobuf.Type; - const importConversationDataMetadata = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createConversationDataset: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createConversationDatasetResponse.decode.bind(createConversationDatasetResponse), - createConversationDatasetMetadata.decode.bind(createConversationDatasetMetadata)), - deleteConversationDataset: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteConversationDatasetResponse.decode.bind(deleteConversationDatasetResponse), - deleteConversationDatasetMetadata.decode.bind(deleteConversationDatasetMetadata)), - importConversationData: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - importConversationDataResponse.decode.bind(importConversationDataResponse), - importConversationDataMetadata.decode.bind(importConversationDataMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2.ConversationDatasets', 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 = this._gaxModule.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.conversationDatasetsStub) { - return this.conversationDatasetsStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2.ConversationDatasets. - this.conversationDatasetsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.ConversationDatasets') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2.ConversationDatasets, - 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 conversationDatasetsStubMethods = - ['createConversationDataset', 'getConversationDataset', 'listConversationDatasets', 'deleteConversationDataset', 'importConversationData']; - for (const methodName of conversationDatasetsStubMethods) { - const callPromise = this.conversationDatasetsStub.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._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.conversationDatasetsStub; - } - - /** - * 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 -- - // ------------------- -/** - * Retrieves the specified conversation dataset. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The conversation dataset to retrieve. Format: - * `projects//locations//conversationDatasets/` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ConversationDataset]{@link google.cloud.dialogflow.v2.ConversationDataset}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/conversation_datasets.get_conversation_dataset.js - * region_tag:dialogflow_v2_generated_ConversationDatasets_GetConversationDataset_async - */ - getConversationDataset( - request?: protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversationDataset, - protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest|undefined, {}|undefined - ]>; - getConversationDataset( - request: protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IConversationDataset, - protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest|null|undefined, - {}|null|undefined>): void; - getConversationDataset( - request: protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IConversationDataset, - protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest|null|undefined, - {}|null|undefined>): void; - getConversationDataset( - request?: protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IConversationDataset, - protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IConversationDataset, - protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversationDataset, - protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getConversationDataset(request, options, callback); - } - -/** - * Creates a new conversation dataset. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: {@link google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata|CreateConversationDatasetOperationMetadata} - * - `response`: {@link google.cloud.dialogflow.v2.ConversationDataset|ConversationDataset} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to create conversation dataset for. Format: - * `projects//locations/` - * @param {google.cloud.dialogflow.v2.ConversationDataset} request.conversationDataset - * Required. The conversation dataset 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 include:samples/generated/v2/conversation_datasets.create_conversation_dataset.js - * region_tag:dialogflow_v2_generated_ConversationDatasets_CreateConversationDataset_async - */ - createConversationDataset( - request?: protos.google.cloud.dialogflow.v2.ICreateConversationDatasetRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createConversationDataset( - request: protos.google.cloud.dialogflow.v2.ICreateConversationDatasetRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createConversationDataset( - request: protos.google.cloud.dialogflow.v2.ICreateConversationDatasetRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createConversationDataset( - request?: protos.google.cloud.dialogflow.v2.ICreateConversationDatasetRequest, - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createConversationDataset(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createConversationDataset()`. - * @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 include:samples/generated/v2/conversation_datasets.create_conversation_dataset.js - * region_tag:dialogflow_v2_generated_ConversationDatasets_CreateConversationDataset_async - */ - async checkCreateConversationDatasetProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createConversationDataset, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes the specified conversation dataset. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: {@link google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata|DeleteConversationDatasetOperationMetadata} - * - `response`: An [Empty - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The conversation dataset to delete. Format: - * `projects//locations//conversationDatasets/` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2/conversation_datasets.delete_conversation_dataset.js - * region_tag:dialogflow_v2_generated_ConversationDatasets_DeleteConversationDataset_async - */ - deleteConversationDataset( - request?: protos.google.cloud.dialogflow.v2.IDeleteConversationDatasetRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteConversationDataset( - request: protos.google.cloud.dialogflow.v2.IDeleteConversationDatasetRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteConversationDataset( - request: protos.google.cloud.dialogflow.v2.IDeleteConversationDatasetRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteConversationDataset( - request?: protos.google.cloud.dialogflow.v2.IDeleteConversationDatasetRequest, - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteConversationDataset(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteConversationDataset()`. - * @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 include:samples/generated/v2/conversation_datasets.delete_conversation_dataset.js - * region_tag:dialogflow_v2_generated_ConversationDatasets_DeleteConversationDataset_async - */ - async checkDeleteConversationDatasetProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteConversationDataset, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Import data into the specified conversation dataset. Note that it - * is not allowed to import data to a conversation dataset that - * already has data in it. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: {@link google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata|ImportConversationDataOperationMetadata} - * - `response`: {@link google.cloud.dialogflow.v2.ImportConversationDataOperationResponse|ImportConversationDataOperationResponse} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Dataset resource name. Format: - * `projects//locations//conversationDatasets/` - * @param {google.cloud.dialogflow.v2.InputConfig} request.inputConfig - * Required. Configuration describing where to import data from. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2/conversation_datasets.import_conversation_data.js - * region_tag:dialogflow_v2_generated_ConversationDatasets_ImportConversationData_async - */ - importConversationData( - request?: protos.google.cloud.dialogflow.v2.IImportConversationDataRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - importConversationData( - request: protos.google.cloud.dialogflow.v2.IImportConversationDataRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importConversationData( - request: protos.google.cloud.dialogflow.v2.IImportConversationDataRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importConversationData( - request?: protos.google.cloud.dialogflow.v2.IImportConversationDataRequest, - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.importConversationData(request, options, callback); - } -/** - * Check the status of the long running operation returned by `importConversationData()`. - * @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 include:samples/generated/v2/conversation_datasets.import_conversation_data.js - * region_tag:dialogflow_v2_generated_ConversationDatasets_ImportConversationData_async - */ - async checkImportConversationDataProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importConversationData, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Returns the list of all conversation datasets in the specified - * project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location name to list all conversation datasets for. - * Format: `projects//locations/` - * @param {number} [request.pageSize] - * Optional. Maximum number of conversation datasets 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 [ConversationDataset]{@link google.cloud.dialogflow.v2.ConversationDataset}. - * 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 `listConversationDatasetsAsync()` - * 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. - */ - listConversationDatasets( - request?: protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversationDataset[], - protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest|null, - protos.google.cloud.dialogflow.v2.IListConversationDatasetsResponse - ]>; - listConversationDatasets( - request: protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, - protos.google.cloud.dialogflow.v2.IListConversationDatasetsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IConversationDataset>): void; - listConversationDatasets( - request: protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, - protos.google.cloud.dialogflow.v2.IListConversationDatasetsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IConversationDataset>): void; - listConversationDatasets( - request?: protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, - protos.google.cloud.dialogflow.v2.IListConversationDatasetsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IConversationDataset>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, - protos.google.cloud.dialogflow.v2.IListConversationDatasetsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IConversationDataset>): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversationDataset[], - protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest|null, - protos.google.cloud.dialogflow.v2.IListConversationDatasetsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listConversationDatasets(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 and location name to list all conversation datasets for. - * Format: `projects//locations/` - * @param {number} [request.pageSize] - * Optional. Maximum number of conversation datasets 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 [ConversationDataset]{@link google.cloud.dialogflow.v2.ConversationDataset} 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 `listConversationDatasetsAsync()` - * 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. - */ - listConversationDatasetsStream( - request?: protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listConversationDatasets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConversationDatasets.createStream( - this.innerApiCalls.listConversationDatasets as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listConversationDatasets`, 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 and location name to list all conversation datasets for. - * Format: `projects//locations/` - * @param {number} [request.pageSize] - * Optional. Maximum number of conversation datasets 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 - * [ConversationDataset]{@link google.cloud.dialogflow.v2.ConversationDataset}. 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 include:samples/generated/v2/conversation_datasets.list_conversation_datasets.js - * region_tag:dialogflow_v2_generated_ConversationDatasets_ListConversationDatasets_async - */ - listConversationDatasetsAsync( - request?: protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listConversationDatasets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConversationDatasets.asyncIterate( - this.innerApiCalls['listConversationDatasets'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. The promise has a method named - * "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified conversationDataset resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_dataset - * @returns {string} Resource name string. - */ - conversationDatasetPath(project:string,location:string,conversationDataset:string) { - return this.pathTemplates.conversationDatasetPathTemplate.render({ - project: project, - location: location, - conversation_dataset: conversationDataset, - }); - } - - /** - * Parse the project from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; - } - - /** - * Parse the location from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; - } - - /** - * Parse the conversation_dataset from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the conversation_dataset. - */ - matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * 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 projectConversationModel resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectConversationModelPath(project:string,conversationModel:string) { - return this.pathTemplates.projectConversationModelPathTemplate.render({ - project: project, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ - project: project, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; - } - - /** - * 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 projectLocationConversationModel resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; - } - - /** - * Parse the location from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; - } - - /** - * Parse the location from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; - } - - /** - * 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 { - if (this.conversationDatasetsStub && !this._terminated) { - return this.conversationDatasetsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_datasets_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_datasets_client_config.json deleted file mode 100644 index 6553edd4445..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_datasets_client_config.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2.ConversationDatasets": { - "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": { - "CreateConversationDataset": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetConversationDataset": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ListConversationDatasets": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteConversationDataset": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ImportConversationData": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_datasets_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_datasets_proto_list.json deleted file mode 100644 index 15e06b6def0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_datasets_proto_list.json +++ /dev/null @@ -1,25 +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_dataset.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/conversation_models_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_models_client.ts deleted file mode 100644 index 6fb8405d2d7..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_models_client.ts +++ /dev/null @@ -1,3725 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v2/conversation_models_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './conversation_models_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Manages a collection of models for human agent assistant. - * @class - * @memberof v2 - */ -export class ConversationModelsClient { - 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}; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - conversationModelsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ConversationModelsClient. - * - * @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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new ConversationModelsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ConversationModelsClient; - 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = { - conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' - ), - 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}' - ), - projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}' - ), - projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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}' - ), - projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' - ), - projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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 = { - listConversationModels: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'conversationModels'), - listConversationModelEvaluations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'conversationModelEvaluations') - }; - - 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. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2/{name=projects/*/operations/*}:cancel',additional_bindings: [{post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=projects/*/operations/*}',additional_bindings: [{get: '/v2/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2/{name=projects/*}/operations',additional_bindings: [{get: '/v2/{name=projects/*/locations/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createConversationModelResponse = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.ConversationModel') as gax.protobuf.Type; - const createConversationModelMetadata = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata') as gax.protobuf.Type; - const deleteConversationModelResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteConversationModelMetadata = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata') as gax.protobuf.Type; - const deployConversationModelResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deployConversationModelMetadata = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata') as gax.protobuf.Type; - const undeployConversationModelResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const undeployConversationModelMetadata = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata') as gax.protobuf.Type; - const createConversationModelEvaluationResponse = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.ConversationModelEvaluation') as gax.protobuf.Type; - const createConversationModelEvaluationMetadata = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createConversationModel: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createConversationModelResponse.decode.bind(createConversationModelResponse), - createConversationModelMetadata.decode.bind(createConversationModelMetadata)), - deleteConversationModel: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteConversationModelResponse.decode.bind(deleteConversationModelResponse), - deleteConversationModelMetadata.decode.bind(deleteConversationModelMetadata)), - deployConversationModel: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deployConversationModelResponse.decode.bind(deployConversationModelResponse), - deployConversationModelMetadata.decode.bind(deployConversationModelMetadata)), - undeployConversationModel: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - undeployConversationModelResponse.decode.bind(undeployConversationModelResponse), - undeployConversationModelMetadata.decode.bind(undeployConversationModelMetadata)), - createConversationModelEvaluation: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createConversationModelEvaluationResponse.decode.bind(createConversationModelEvaluationResponse), - createConversationModelEvaluationMetadata.decode.bind(createConversationModelEvaluationMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.dialogflow.v2.ConversationModels', 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 = this._gaxModule.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.conversationModelsStub) { - return this.conversationModelsStub; - } - - // Put together the "service stub" for - // google.cloud.dialogflow.v2.ConversationModels. - this.conversationModelsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.dialogflow.v2.ConversationModels') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.dialogflow.v2.ConversationModels, - 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 conversationModelsStubMethods = - ['createConversationModel', 'getConversationModel', 'listConversationModels', 'deleteConversationModel', 'deployConversationModel', 'undeployConversationModel', 'getConversationModelEvaluation', 'listConversationModelEvaluations', 'createConversationModelEvaluation']; - for (const methodName of conversationModelsStubMethods) { - const callPromise = this.conversationModelsStub.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._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.conversationModelsStub; - } - - /** - * 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 -- - // ------------------- -/** - * Gets conversation model. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The conversation model to retrieve. Format: - * `projects//conversationModels/` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ConversationModel]{@link google.cloud.dialogflow.v2.ConversationModel}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/conversation_models.get_conversation_model.js - * region_tag:dialogflow_v2_generated_ConversationModels_GetConversationModel_async - */ - getConversationModel( - request?: protos.google.cloud.dialogflow.v2.IGetConversationModelRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversationModel, - protos.google.cloud.dialogflow.v2.IGetConversationModelRequest|undefined, {}|undefined - ]>; - getConversationModel( - request: protos.google.cloud.dialogflow.v2.IGetConversationModelRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IConversationModel, - protos.google.cloud.dialogflow.v2.IGetConversationModelRequest|null|undefined, - {}|null|undefined>): void; - getConversationModel( - request: protos.google.cloud.dialogflow.v2.IGetConversationModelRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IConversationModel, - protos.google.cloud.dialogflow.v2.IGetConversationModelRequest|null|undefined, - {}|null|undefined>): void; - getConversationModel( - request?: protos.google.cloud.dialogflow.v2.IGetConversationModelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IConversationModel, - protos.google.cloud.dialogflow.v2.IGetConversationModelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IConversationModel, - protos.google.cloud.dialogflow.v2.IGetConversationModelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversationModel, - protos.google.cloud.dialogflow.v2.IGetConversationModelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getConversationModel(request, options, callback); - } -/** - * Gets an evaluation of conversation model. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The conversation model evaluation resource name. Format: - * `projects//conversationModels//evaluations/` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ConversationModelEvaluation]{@link google.cloud.dialogflow.v2.ConversationModelEvaluation}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/conversation_models.get_conversation_model_evaluation.js - * region_tag:dialogflow_v2_generated_ConversationModels_GetConversationModelEvaluation_async - */ - getConversationModelEvaluation( - request?: protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, - protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest|undefined, {}|undefined - ]>; - getConversationModelEvaluation( - request: protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, - protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest|null|undefined, - {}|null|undefined>): void; - getConversationModelEvaluation( - request: protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, - protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest|null|undefined, - {}|null|undefined>): void; - getConversationModelEvaluation( - request?: protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, - protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, - protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, - protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getConversationModelEvaluation(request, options, callback); - } - -/** - * Creates a model. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: {@link google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata|CreateConversationModelOperationMetadata} - * - `response`: {@link google.cloud.dialogflow.v2.ConversationModel|ConversationModel} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The project to create conversation model for. Format: - * `projects/` - * @param {google.cloud.dialogflow.v2.ConversationModel} request.conversationModel - * Required. The conversation model 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 include:samples/generated/v2/conversation_models.create_conversation_model.js - * region_tag:dialogflow_v2_generated_ConversationModels_CreateConversationModel_async - */ - createConversationModel( - request?: protos.google.cloud.dialogflow.v2.ICreateConversationModelRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createConversationModel( - request: protos.google.cloud.dialogflow.v2.ICreateConversationModelRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createConversationModel( - request: protos.google.cloud.dialogflow.v2.ICreateConversationModelRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createConversationModel( - request?: protos.google.cloud.dialogflow.v2.ICreateConversationModelRequest, - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createConversationModel(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createConversationModel()`. - * @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 include:samples/generated/v2/conversation_models.create_conversation_model.js - * region_tag:dialogflow_v2_generated_ConversationModels_CreateConversationModel_async - */ - async checkCreateConversationModelProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createConversationModel, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a model. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: {@link google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata|DeleteConversationModelOperationMetadata} - * - `response`: An [Empty - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The conversation model to delete. Format: - * `projects//conversationModels/` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2/conversation_models.delete_conversation_model.js - * region_tag:dialogflow_v2_generated_ConversationModels_DeleteConversationModel_async - */ - deleteConversationModel( - request?: protos.google.cloud.dialogflow.v2.IDeleteConversationModelRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteConversationModel( - request: protos.google.cloud.dialogflow.v2.IDeleteConversationModelRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteConversationModel( - request: protos.google.cloud.dialogflow.v2.IDeleteConversationModelRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteConversationModel( - request?: protos.google.cloud.dialogflow.v2.IDeleteConversationModelRequest, - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteConversationModel(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteConversationModel()`. - * @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 include:samples/generated/v2/conversation_models.delete_conversation_model.js - * region_tag:dialogflow_v2_generated_ConversationModels_DeleteConversationModel_async - */ - async checkDeleteConversationModelProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteConversationModel, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deploys a model. If a model is already deployed, deploying it - * has no effect. A model can only serve prediction requests after it gets - * deployed. For article suggestion, custom model will not be used unless - * it is deployed. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: {@link google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata|DeployConversationModelOperationMetadata} - * - `response`: An [Empty - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The conversation model to deploy. Format: - * `projects//conversationModels/` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2/conversation_models.deploy_conversation_model.js - * region_tag:dialogflow_v2_generated_ConversationModels_DeployConversationModel_async - */ - deployConversationModel( - request?: protos.google.cloud.dialogflow.v2.IDeployConversationModelRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deployConversationModel( - request: protos.google.cloud.dialogflow.v2.IDeployConversationModelRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deployConversationModel( - request: protos.google.cloud.dialogflow.v2.IDeployConversationModelRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deployConversationModel( - request?: protos.google.cloud.dialogflow.v2.IDeployConversationModelRequest, - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deployConversationModel(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deployConversationModel()`. - * @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 include:samples/generated/v2/conversation_models.deploy_conversation_model.js - * region_tag:dialogflow_v2_generated_ConversationModels_DeployConversationModel_async - */ - async checkDeployConversationModelProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deployConversationModel, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Undeploys a model. If the model is not deployed this method has no effect. - * If the model is currently being used: - * - For article suggestion, article suggestion will fallback to the default - * model if model is undeployed. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: {@link google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata|UndeployConversationModelOperationMetadata} - * - `response`: An [Empty - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The conversation model to undeploy. Format: - * `projects//conversationModels/` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2/conversation_models.undeploy_conversation_model.js - * region_tag:dialogflow_v2_generated_ConversationModels_UndeployConversationModel_async - */ - undeployConversationModel( - request?: protos.google.cloud.dialogflow.v2.IUndeployConversationModelRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - undeployConversationModel( - request: protos.google.cloud.dialogflow.v2.IUndeployConversationModelRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - undeployConversationModel( - request: protos.google.cloud.dialogflow.v2.IUndeployConversationModelRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - undeployConversationModel( - request?: protos.google.cloud.dialogflow.v2.IUndeployConversationModelRequest, - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.undeployConversationModel(request, options, callback); - } -/** - * Check the status of the long running operation returned by `undeployConversationModel()`. - * @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 include:samples/generated/v2/conversation_models.undeploy_conversation_model.js - * region_tag:dialogflow_v2_generated_ConversationModels_UndeployConversationModel_async - */ - async checkUndeployConversationModelProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.undeployConversationModel, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates evaluation of a conversation model. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The conversation model resource name. Format: - * `projects//locations//conversationModels/` - * @param {google.cloud.dialogflow.v2.ConversationModelEvaluation} request.conversationModelEvaluation - * Required. The conversation model evaluation to be created. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2/conversation_models.create_conversation_model_evaluation.js - * region_tag:dialogflow_v2_generated_ConversationModels_CreateConversationModelEvaluation_async - */ - createConversationModelEvaluation( - request?: protos.google.cloud.dialogflow.v2.ICreateConversationModelEvaluationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createConversationModelEvaluation( - request: protos.google.cloud.dialogflow.v2.ICreateConversationModelEvaluationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createConversationModelEvaluation( - request: protos.google.cloud.dialogflow.v2.ICreateConversationModelEvaluationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createConversationModelEvaluation( - request?: protos.google.cloud.dialogflow.v2.ICreateConversationModelEvaluationRequest, - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createConversationModelEvaluation(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createConversationModelEvaluation()`. - * @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 include:samples/generated/v2/conversation_models.create_conversation_model_evaluation.js - * region_tag:dialogflow_v2_generated_ConversationModels_CreateConversationModelEvaluation_async - */ - async checkCreateConversationModelEvaluationProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createConversationModelEvaluation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists conversation models. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project to list all conversation models for. - * Format: `projects/` - * @param {number} [request.pageSize] - * Optional. Maximum number of conversation models 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 [ConversationModel]{@link google.cloud.dialogflow.v2.ConversationModel}. - * 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 `listConversationModelsAsync()` - * 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. - */ - listConversationModels( - request?: protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversationModel[], - protos.google.cloud.dialogflow.v2.IListConversationModelsRequest|null, - protos.google.cloud.dialogflow.v2.IListConversationModelsResponse - ]>; - listConversationModels( - request: protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, - protos.google.cloud.dialogflow.v2.IListConversationModelsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IConversationModel>): void; - listConversationModels( - request: protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, - protos.google.cloud.dialogflow.v2.IListConversationModelsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IConversationModel>): void; - listConversationModels( - request?: protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, - protos.google.cloud.dialogflow.v2.IListConversationModelsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IConversationModel>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, - protos.google.cloud.dialogflow.v2.IListConversationModelsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IConversationModel>): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversationModel[], - protos.google.cloud.dialogflow.v2.IListConversationModelsRequest|null, - protos.google.cloud.dialogflow.v2.IListConversationModelsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listConversationModels(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 models for. - * Format: `projects/` - * @param {number} [request.pageSize] - * Optional. Maximum number of conversation models 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 [ConversationModel]{@link google.cloud.dialogflow.v2.ConversationModel} 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 `listConversationModelsAsync()` - * 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. - */ - listConversationModelsStream( - request?: protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listConversationModels']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConversationModels.createStream( - this.innerApiCalls.listConversationModels as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listConversationModels`, 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 models for. - * Format: `projects/` - * @param {number} [request.pageSize] - * Optional. Maximum number of conversation models 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 - * [ConversationModel]{@link google.cloud.dialogflow.v2.ConversationModel}. 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 include:samples/generated/v2/conversation_models.list_conversation_models.js - * region_tag:dialogflow_v2_generated_ConversationModels_ListConversationModels_async - */ - listConversationModelsAsync( - request?: protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listConversationModels']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConversationModels.asyncIterate( - this.innerApiCalls['listConversationModels'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists evaluations of a conversation model. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The conversation model resource name. Format: - * `projects//conversationModels/` - * @param {number} [request.pageSize] - * Optional. Maximum number of evaluations 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 [ConversationModelEvaluation]{@link google.cloud.dialogflow.v2.ConversationModelEvaluation}. - * 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 `listConversationModelEvaluationsAsync()` - * 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. - */ - listConversationModelEvaluations( - request?: protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversationModelEvaluation[], - protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest|null, - protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse - ]>; - listConversationModelEvaluations( - request: protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, - protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IConversationModelEvaluation>): void; - listConversationModelEvaluations( - request: protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, - callback: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, - protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IConversationModelEvaluation>): void; - listConversationModelEvaluations( - request?: protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, - protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IConversationModelEvaluation>, - callback?: PaginationCallback< - protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, - protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse|null|undefined, - protos.google.cloud.dialogflow.v2.IConversationModelEvaluation>): - Promise<[ - protos.google.cloud.dialogflow.v2.IConversationModelEvaluation[], - protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest|null, - protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listConversationModelEvaluations(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 model resource name. Format: - * `projects//conversationModels/` - * @param {number} [request.pageSize] - * Optional. Maximum number of evaluations 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 [ConversationModelEvaluation]{@link google.cloud.dialogflow.v2.ConversationModelEvaluation} 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 `listConversationModelEvaluationsAsync()` - * 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. - */ - listConversationModelEvaluationsStream( - request?: protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listConversationModelEvaluations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConversationModelEvaluations.createStream( - this.innerApiCalls.listConversationModelEvaluations as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listConversationModelEvaluations`, 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 model resource name. Format: - * `projects//conversationModels/` - * @param {number} [request.pageSize] - * Optional. Maximum number of evaluations 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 - * [ConversationModelEvaluation]{@link google.cloud.dialogflow.v2.ConversationModelEvaluation}. 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 include:samples/generated/v2/conversation_models.list_conversation_model_evaluations.js - * region_tag:dialogflow_v2_generated_ConversationModels_ListConversationModelEvaluations_async - */ - listConversationModelEvaluationsAsync( - request?: protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listConversationModelEvaluations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConversationModelEvaluations.asyncIterate( - this.innerApiCalls['listConversationModelEvaluations'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. The promise has a method named - * "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified conversationDataset resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_dataset - * @returns {string} Resource name string. - */ - conversationDatasetPath(project:string,location:string,conversationDataset:string) { - return this.pathTemplates.conversationDatasetPathTemplate.render({ - project: project, - location: location, - conversation_dataset: conversationDataset, - }); - } - - /** - * Parse the project from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; - } - - /** - * Parse the location from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; - } - - /** - * Parse the conversation_dataset from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the conversation_dataset. - */ - matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; - } - - /** - * 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 projectConversationModel resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectConversationModelPath(project:string,conversationModel:string) { - return this.pathTemplates.projectConversationModelPathTemplate.render({ - project: project, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ - project: project, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; - } - - /** - * 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 projectLocationConversationModel resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; - } - - /** - * Parse the location from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; - } - - /** - * Parse the location from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; - } - - /** - * 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 { - if (this.conversationModelsStub && !this._terminated) { - return this.conversationModelsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_models_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_models_client_config.json deleted file mode 100644 index 8f65b8621ef..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_models_client_config.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "interfaces": { - "google.cloud.dialogflow.v2.ConversationModels": { - "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": { - "CreateConversationModel": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetConversationModel": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ListConversationModels": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeleteConversationModel": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "DeployConversationModel": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "UndeployConversationModel": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "GetConversationModelEvaluation": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ListConversationModelEvaluations": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CreateConversationModelEvaluation": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_models_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_models_proto_list.json deleted file mode 100644 index 15e06b6def0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_models_proto_list.json +++ /dev/null @@ -1,25 +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_dataset.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/conversation_profiles_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_profiles_client.ts deleted file mode 100644 index 74acd19128e..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_profiles_client.ts +++ /dev/null @@ -1,3445 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -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}; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new ConversationProfilesClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = { - cXSecuritySettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securitySettings/{security_settings}' - ), - conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' - ), - 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}' - ), - projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}' - ), - projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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}' - ), - projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' - ), - projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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') - }; - - 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. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2/{name=projects/*/operations/*}:cancel',additional_bindings: [{post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=projects/*/operations/*}',additional_bindings: [{get: '/v2/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2/{name=projects/*}/operations',additional_bindings: [{get: '/v2/{name=projects/*/locations/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const setSuggestionFeatureConfigResponse = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.ConversationProfile') as gax.protobuf.Type; - const setSuggestionFeatureConfigMetadata = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata') as gax.protobuf.Type; - const clearSuggestionFeatureConfigResponse = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.ConversationProfile') as gax.protobuf.Type; - const clearSuggestionFeatureConfigMetadata = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - setSuggestionFeatureConfig: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - setSuggestionFeatureConfigResponse.decode.bind(setSuggestionFeatureConfigResponse), - setSuggestionFeatureConfigMetadata.decode.bind(setSuggestionFeatureConfigMetadata)), - clearSuggestionFeatureConfig: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - clearSuggestionFeatureConfigResponse.decode.bind(clearSuggestionFeatureConfigResponse), - clearSuggestionFeatureConfigMetadata.decode.bind(clearSuggestionFeatureConfigMetadata)) - }; - - // 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 = this._gaxModule.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', 'setSuggestionFeatureConfig', 'clearSuggestionFeatureConfig']; - 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] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2/conversation_profiles.get_conversation_profile.js - * region_tag:dialogflow_v2_generated_ConversationProfiles_GetConversationProfile_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getConversationProfile(request, options, callback); - } -/** - * 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 include:samples/generated/v2/conversation_profiles.create_conversation_profile.js - * region_tag:dialogflow_v2_generated_ConversationProfiles_CreateConversationProfile_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createConversationProfile(request, options, callback); - } -/** - * 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 include:samples/generated/v2/conversation_profiles.update_conversation_profile.js - * region_tag:dialogflow_v2_generated_ConversationProfiles_UpdateConversationProfile_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'conversation_profile.name': request.conversationProfile!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateConversationProfile(request, options, callback); - } -/** - * 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 include:samples/generated/v2/conversation_profiles.delete_conversation_profile.js - * region_tag:dialogflow_v2_generated_ConversationProfiles_DeleteConversationProfile_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteConversationProfile(request, options, callback); - } - -/** - * Adds or updates a suggestion feature in a conversation profile. - * If the conversation profile contains the type of suggestion feature for - * the participant role, it will update it. Otherwise it will insert the - * suggestion feature. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: {@link google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata|SetSuggestionFeatureConfigOperationMetadata} - * - `response`: {@link google.cloud.dialogflow.v2.ConversationProfile|ConversationProfile} - * - * If a long running operation to add or update suggestion feature - * config for the same conversation profile, participant role and suggestion - * feature type exists, please cancel the existing long running operation - * before sending such request, otherwise the request will be rejected. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.conversationProfile - * Required. The Conversation Profile to add or update the suggestion feature - * config. Format: `projects//locations//conversationProfiles/`. - * @param {google.cloud.dialogflow.v2.Participant.Role} request.participantRole - * Required. The participant role to add or update the suggestion feature - * config. Only HUMAN_AGENT or END_USER can be used. - * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig} request.suggestionFeatureConfig - * Required. The suggestion feature config to add or 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 - * 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 include:samples/generated/v2/conversation_profiles.set_suggestion_feature_config.js - * region_tag:dialogflow_v2_generated_ConversationProfiles_SetSuggestionFeatureConfig_async - */ - setSuggestionFeatureConfig( - request?: protos.google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - setSuggestionFeatureConfig( - request: protos.google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - setSuggestionFeatureConfig( - request: protos.google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - setSuggestionFeatureConfig( - request?: protos.google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigRequest, - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'conversation_profile': request.conversationProfile ?? '', - }); - this.initialize(); - return this.innerApiCalls.setSuggestionFeatureConfig(request, options, callback); - } -/** - * Check the status of the long running operation returned by `setSuggestionFeatureConfig()`. - * @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 include:samples/generated/v2/conversation_profiles.set_suggestion_feature_config.js - * region_tag:dialogflow_v2_generated_ConversationProfiles_SetSuggestionFeatureConfig_async - */ - async checkSetSuggestionFeatureConfigProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.setSuggestionFeatureConfig, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Clears a suggestion feature from a conversation profile for the given - * participant role. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: {@link google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata|ClearSuggestionFeatureConfigOperationMetadata} - * - `response`: {@link google.cloud.dialogflow.v2.ConversationProfile|ConversationProfile} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.conversationProfile - * Required. The Conversation Profile to add or update the suggestion feature - * config. Format: `projects//locations//conversationProfiles/`. - * @param {google.cloud.dialogflow.v2.Participant.Role} request.participantRole - * Required. The participant role to remove the suggestion feature - * config. Only HUMAN_AGENT or END_USER can be used. - * @param {google.cloud.dialogflow.v2.SuggestionFeature.Type} request.suggestionFeatureType - * Required. The type of the suggestion feature to remove. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2/conversation_profiles.clear_suggestion_feature_config.js - * region_tag:dialogflow_v2_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async - */ - clearSuggestionFeatureConfig( - request?: protos.google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - clearSuggestionFeatureConfig( - request: protos.google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - clearSuggestionFeatureConfig( - request: protos.google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - clearSuggestionFeatureConfig( - request?: protos.google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigRequest, - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'conversation_profile': request.conversationProfile ?? '', - }); - this.initialize(); - return this.innerApiCalls.clearSuggestionFeatureConfig(request, options, callback); - } -/** - * Check the status of the long running operation returned by `clearSuggestionFeatureConfig()`. - * @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 include:samples/generated/v2/conversation_profiles.clear_suggestion_feature_config.js - * region_tag:dialogflow_v2_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async - */ - async checkClearSuggestionFeatureConfigProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.clearSuggestionFeatureConfig, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listConversationProfiles']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConversationProfiles.createStream( - this.innerApiCalls.listConversationProfiles as 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 include:samples/generated/v2/conversation_profiles.list_conversation_profiles.js - * region_tag:dialogflow_v2_generated_ConversationProfiles_ListConversationProfiles_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listConversationProfiles']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConversationProfiles.asyncIterate( - this.innerApiCalls['listConversationProfiles'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. The promise has a method named - * "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified cXSecuritySettings resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} security_settings - * @returns {string} Resource name string. - */ - cXSecuritySettingsPath(project:string,location:string,securitySettings:string) { - return this.pathTemplates.cXSecuritySettingsPathTemplate.render({ - project: project, - location: location, - security_settings: securitySettings, - }); - } - - /** - * Parse the project from CXSecuritySettings resource. - * - * @param {string} cXSecuritySettingsName - * A fully-qualified path representing CXSecuritySettings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCXSecuritySettingsName(cXSecuritySettingsName: string) { - return this.pathTemplates.cXSecuritySettingsPathTemplate.match(cXSecuritySettingsName).project; - } - - /** - * Parse the location from CXSecuritySettings resource. - * - * @param {string} cXSecuritySettingsName - * A fully-qualified path representing CXSecuritySettings resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCXSecuritySettingsName(cXSecuritySettingsName: string) { - return this.pathTemplates.cXSecuritySettingsPathTemplate.match(cXSecuritySettingsName).location; - } - - /** - * Parse the security_settings from CXSecuritySettings resource. - * - * @param {string} cXSecuritySettingsName - * A fully-qualified path representing CXSecuritySettings resource. - * @returns {string} A string representing the security_settings. - */ - matchSecuritySettingsFromCXSecuritySettingsName(cXSecuritySettingsName: string) { - return this.pathTemplates.cXSecuritySettingsPathTemplate.match(cXSecuritySettingsName).security_settings; - } - - /** - * Return a fully-qualified conversationDataset resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_dataset - * @returns {string} Resource name string. - */ - conversationDatasetPath(project:string,location:string,conversationDataset:string) { - return this.pathTemplates.conversationDatasetPathTemplate.render({ - project: project, - location: location, - conversation_dataset: conversationDataset, - }); - } - - /** - * Parse the project from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; - } - - /** - * Parse the location from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; - } - - /** - * Parse the conversation_dataset from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the conversation_dataset. - */ - matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; - } - - /** - * 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 projectConversationModel resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectConversationModelPath(project:string,conversationModel:string) { - return this.pathTemplates.projectConversationModelPathTemplate.render({ - project: project, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ - project: project, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; - } - - /** - * 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 projectLocationConversationModel resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; - } - - /** - * Parse the location from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; - } - - /** - * Parse the location from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; - } - - /** - * 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 { - if (this.conversationProfilesStub && !this._terminated) { - return this.conversationProfilesStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_profiles_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_profiles_client_config.json deleted file mode 100644 index 655ad79beb0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_profiles_client_config.json +++ /dev/null @@ -1,64 +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" - }, - "SetSuggestionFeatureConfig": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ClearSuggestionFeatureConfig": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_profiles_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_profiles_proto_list.json deleted file mode 100644 index 15e06b6def0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversation_profiles_proto_list.json +++ /dev/null @@ -1,25 +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_dataset.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/conversations_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversations_client.ts deleted file mode 100644 index 5b3967a2a35..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversations_client.ts +++ /dev/null @@ -1,3175 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new ConversationsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = { - conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' - ), - 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}' - ), - projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}' - ), - projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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}' - ), - projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' - ), - projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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 = this._gaxModule.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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2/conversations.create_conversation.js - * region_tag:dialogflow_v2_generated_Conversations_CreateConversation_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createConversation(request, options, callback); - } -/** - * 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 include:samples/generated/v2/conversations.get_conversation.js - * region_tag:dialogflow_v2_generated_Conversations_GetConversation_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getConversation(request, options, callback); - } -/** - * 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 include:samples/generated/v2/conversations.complete_conversation.js - * region_tag:dialogflow_v2_generated_Conversations_CompleteConversation_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.completeConversation(request, options, callback); - } - - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listConversations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConversations.createStream( - this.innerApiCalls.listConversations as 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 include:samples/generated/v2/conversations.list_conversations.js - * region_tag:dialogflow_v2_generated_Conversations_ListConversations_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listConversations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConversations.asyncIterate( - this.innerApiCalls['listConversations'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listMessages']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMessages.createStream( - this.innerApiCalls.listMessages as 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 include:samples/generated/v2/conversations.list_messages.js - * region_tag:dialogflow_v2_generated_Conversations_ListMessages_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listMessages']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMessages.asyncIterate( - this.innerApiCalls['listMessages'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified conversationDataset resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_dataset - * @returns {string} Resource name string. - */ - conversationDatasetPath(project:string,location:string,conversationDataset:string) { - return this.pathTemplates.conversationDatasetPathTemplate.render({ - project: project, - location: location, - conversation_dataset: conversationDataset, - }); - } - - /** - * Parse the project from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; - } - - /** - * Parse the location from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; - } - - /** - * Parse the conversation_dataset from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the conversation_dataset. - */ - matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; - } - - /** - * 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 projectConversationModel resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectConversationModelPath(project:string,conversationModel:string) { - return this.pathTemplates.projectConversationModelPathTemplate.render({ - project: project, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ - project: project, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; - } - - /** - * 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 projectLocationConversationModel resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; - } - - /** - * Parse the location from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; - } - - /** - * Parse the location from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; - } - - /** - * 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 { - if (this.conversationsStub && !this._terminated) { - return this.conversationsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversations_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversations_client_config.json deleted file mode 100644 index 2718600c519..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/src/v2/conversations_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversations_proto_list.json deleted file mode 100644 index 15e06b6def0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/conversations_proto_list.json +++ /dev/null @@ -1,25 +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_dataset.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/documents_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/documents_client.ts deleted file mode 100644 index e3d41658de3..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/documents_client.ts +++ /dev/null @@ -1,3693 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -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'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new DocumentsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = { - conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' - ), - 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}' - ), - projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}' - ), - projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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}' - ), - projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' - ), - projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2/{name=projects/*/operations/*}:cancel',additional_bindings: [{post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=projects/*/operations/*}',additional_bindings: [{get: '/v2/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2/{name=projects/*}/operations',additional_bindings: [{get: '/v2/{name=projects/*/locations/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).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 importDocumentsResponse = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.ImportDocumentsResponse') as gax.protobuf.Type; - const importDocumentsMetadata = 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; - const exportDocumentResponse = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2.Document') as gax.protobuf.Type; - const exportDocumentMetadata = 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)), - 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)), - exportDocument: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - exportDocumentResponse.decode.bind(exportDocumentResponse), - exportDocumentMetadata.decode.bind(exportDocumentMetadata)) - }; - - // 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 = this._gaxModule.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', 'importDocuments', 'deleteDocument', 'updateDocument', 'reloadDocument', 'exportDocument']; - 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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2/documents.get_document.js - * region_tag:dialogflow_v2_generated_Documents_GetDocument_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getDocument(request, options, callback); - } - -/** - * Creates a new document. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: {@link google.cloud.dialogflow.v2.KnowledgeOperationMetadata|KnowledgeOperationMetadata} - * - `response`: {@link google.cloud.dialogflow.v2.Document|Document} - * - * @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 include:samples/generated/v2/documents.create_document.js - * region_tag:dialogflow_v2_generated_Documents_CreateDocument_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2/documents.create_document.js - * region_tag:dialogflow_v2_generated_Documents_CreateDocument_async - */ - async checkCreateDocumentProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createDocument, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates 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. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: {@link google.cloud.dialogflow.v2.KnowledgeOperationMetadata|KnowledgeOperationMetadata} - * - `response`: {@link google.cloud.dialogflow.v2.ImportDocumentsResponse|ImportDocumentsResponse} - * - * @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.v2.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.v2.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 include:samples/generated/v2/documents.import_documents.js - * region_tag:dialogflow_v2_generated_Documents_ImportDocuments_async - */ - importDocuments( - request?: protos.google.cloud.dialogflow.v2.IImportDocumentsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - importDocuments( - request: protos.google.cloud.dialogflow.v2.IImportDocumentsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importDocuments( - request: protos.google.cloud.dialogflow.v2.IImportDocumentsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importDocuments( - request?: protos.google.cloud.dialogflow.v2.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' - ] = this._gaxModule.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 include:samples/generated/v2/documents.import_documents.js - * region_tag:dialogflow_v2_generated_Documents_ImportDocuments_async - */ - async checkImportDocumentsProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importDocuments, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes the specified document. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: {@link google.cloud.dialogflow.v2.KnowledgeOperationMetadata|KnowledgeOperationMetadata} - * - `response`: An [Empty - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - * - * @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 include:samples/generated/v2/documents.delete_document.js - * region_tag:dialogflow_v2_generated_Documents_DeleteDocument_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2/documents.delete_document.js - * region_tag:dialogflow_v2_generated_Documents_DeleteDocument_async - */ - async checkDeleteDocumentProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteDocument, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the specified document. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: {@link google.cloud.dialogflow.v2.KnowledgeOperationMetadata|KnowledgeOperationMetadata} - * - `response`: {@link google.cloud.dialogflow.v2.Document|Document} - * - * @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 include:samples/generated/v2/documents.update_document.js - * region_tag:dialogflow_v2_generated_Documents_UpdateDocument_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2/documents.update_document.js - * region_tag:dialogflow_v2_generated_Documents_UpdateDocument_async - */ - async checkUpdateDocumentProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateDocument, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * 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. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: {@link google.cloud.dialogflow.v2.KnowledgeOperationMetadata|KnowledgeOperationMetadata} - * - `response`: {@link google.cloud.dialogflow.v2.Document|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 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 {boolean} [request.importGcsCustomMetadata] - * Optional. Whether to import custom metadata from Google Cloud Storage. - * Only valid when the document source is Google Cloud Storage URI. - * @param {boolean} [request.smartMessagingPartialUpdate] - * Optional. When enabled, the reload request is to apply partial update to the smart - * messaging allowlist. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2/documents.reload_document.js - * region_tag:dialogflow_v2_generated_Documents_ReloadDocument_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2/documents.reload_document.js - * region_tag:dialogflow_v2_generated_Documents_ReloadDocument_async - */ - async checkReloadDocumentProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.reloadDocument, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Exports a smart messaging candidate document into the specified - * destination. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: {@link google.cloud.dialogflow.v2.KnowledgeOperationMetadata|KnowledgeOperationMetadata} - * - `response`: {@link google.cloud.dialogflow.v2.Document|Document} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the document to export. - * Format: `projects//locations//knowledgeBases//documents/`. - * @param {google.cloud.dialogflow.v2.GcsDestination} request.gcsDestination - * Cloud Storage file path to export the document. - * @param {boolean} request.exportFullContent - * When enabled, export the full content of the document including empirical - * probability. - * @param {boolean} request.smartMessagingPartialUpdate - * When enabled, export the smart messaging allowlist document for partial - * 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 - * 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 include:samples/generated/v2/documents.export_document.js - * region_tag:dialogflow_v2_generated_Documents_ExportDocument_async - */ - exportDocument( - request?: protos.google.cloud.dialogflow.v2.IExportDocumentRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - exportDocument( - request: protos.google.cloud.dialogflow.v2.IExportDocumentRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportDocument( - request: protos.google.cloud.dialogflow.v2.IExportDocumentRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportDocument( - request?: protos.google.cloud.dialogflow.v2.IExportDocumentRequest, - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.exportDocument(request, options, callback); - } -/** - * Check the status of the long running operation returned by `exportDocument()`. - * @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 include:samples/generated/v2/documents.export_document.js - * region_tag:dialogflow_v2_generated_Documents_ExportDocument_async - */ - async checkExportDocumentProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportDocument, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * 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 {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.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, - 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; - 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' - ] = this._gaxModule.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.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listDocuments']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDocuments.createStream( - this.innerApiCalls.listDocuments as 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.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 include:samples/generated/v2/documents.list_documents.js - * region_tag:dialogflow_v2_generated_Documents_ListDocuments_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listDocuments']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDocuments.asyncIterate( - this.innerApiCalls['listDocuments'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. The promise has a method named - * "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified conversationDataset resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_dataset - * @returns {string} Resource name string. - */ - conversationDatasetPath(project:string,location:string,conversationDataset:string) { - return this.pathTemplates.conversationDatasetPathTemplate.render({ - project: project, - location: location, - conversation_dataset: conversationDataset, - }); - } - - /** - * Parse the project from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; - } - - /** - * Parse the location from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; - } - - /** - * Parse the conversation_dataset from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the conversation_dataset. - */ - matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; - } - - /** - * 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 projectConversationModel resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectConversationModelPath(project:string,conversationModel:string) { - return this.pathTemplates.projectConversationModelPathTemplate.render({ - project: project, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ - project: project, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; - } - - /** - * 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 projectLocationConversationModel resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; - } - - /** - * Parse the location from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; - } - - /** - * Parse the location from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; - } - - /** - * 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 { - if (this.documentsStub && !this._terminated) { - return this.documentsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/documents_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/documents_client_config.json deleted file mode 100644 index e9c31efb148..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/documents_client_config.json +++ /dev/null @@ -1,69 +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" - }, - "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" - }, - "ExportDocument": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/documents_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/documents_proto_list.json deleted file mode 100644 index 15e06b6def0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/documents_proto_list.json +++ /dev/null @@ -1,25 +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_dataset.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/entity_types_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/entity_types_client.ts deleted file mode 100644 index c27a86f9fc0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/entity_types_client.ts +++ /dev/null @@ -1,3809 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -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'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new EntityTypesClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = { - conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' - ), - 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}' - ), - projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}' - ), - projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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}' - ), - projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' - ), - projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2/{name=projects/*/operations/*}:cancel',additional_bindings: [{post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=projects/*/operations/*}',additional_bindings: [{get: '/v2/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2/{name=projects/*}/operations',additional_bindings: [{get: '/v2/{name=projects/*/locations/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).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 = this._gaxModule.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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2/entity_types.get_entity_type.js - * region_tag:dialogflow_v2_generated_EntityTypes_GetEntityType_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getEntityType(request, options, callback); - } -/** - * 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 include:samples/generated/v2/entity_types.create_entity_type.js - * region_tag:dialogflow_v2_generated_EntityTypes_CreateEntityType_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createEntityType(request, options, callback); - } -/** - * 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 include:samples/generated/v2/entity_types.update_entity_type.js - * region_tag:dialogflow_v2_generated_EntityTypes_UpdateEntityType_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'entity_type.name': request.entityType!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateEntityType(request, options, callback); - } -/** - * 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 include:samples/generated/v2/entity_types.delete_entity_type.js - * region_tag:dialogflow_v2_generated_EntityTypes_DeleteEntityType_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteEntityType(request, options, callback); - } - -/** - * Updates/Creates multiple entity types in the specified agent. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: An empty [Struct - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - * - `response`: {@link google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse|BatchUpdateEntityTypesResponse} - * - * 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 include:samples/generated/v2/entity_types.batch_update_entity_types.js - * region_tag:dialogflow_v2_generated_EntityTypes_BatchUpdateEntityTypes_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2/entity_types.batch_update_entity_types.js - * region_tag:dialogflow_v2_generated_EntityTypes_BatchUpdateEntityTypes_async - */ - async checkBatchUpdateEntityTypesProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchUpdateEntityTypes, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes entity types in the specified agent. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: An empty [Struct - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - * - `response`: An [Empty - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - * - * 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 include:samples/generated/v2/entity_types.batch_delete_entity_types.js - * region_tag:dialogflow_v2_generated_EntityTypes_BatchDeleteEntityTypes_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2/entity_types.batch_delete_entity_types.js - * region_tag:dialogflow_v2_generated_EntityTypes_BatchDeleteEntityTypes_async - */ - async checkBatchDeleteEntityTypesProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchDeleteEntityTypes, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates multiple new entities in the specified entity type. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: An empty [Struct - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - * - `response`: An [Empty - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - * - * 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 include:samples/generated/v2/entity_types.batch_create_entities.js - * region_tag:dialogflow_v2_generated_EntityTypes_BatchCreateEntities_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2/entity_types.batch_create_entities.js - * region_tag:dialogflow_v2_generated_EntityTypes_BatchCreateEntities_async - */ - async checkBatchCreateEntitiesProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchCreateEntities, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * 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. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: An empty [Struct - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - * - `response`: An [Empty - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - * - * 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 include:samples/generated/v2/entity_types.batch_update_entities.js - * region_tag:dialogflow_v2_generated_EntityTypes_BatchUpdateEntities_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2/entity_types.batch_update_entities.js - * region_tag:dialogflow_v2_generated_EntityTypes_BatchUpdateEntities_async - */ - async checkBatchUpdateEntitiesProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchUpdateEntities, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes entities in the specified entity type. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: An empty [Struct - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - * - `response`: An [Empty - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - * - * 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 include:samples/generated/v2/entity_types.batch_delete_entities.js - * region_tag:dialogflow_v2_generated_EntityTypes_BatchDeleteEntities_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2/entity_types.batch_delete_entities.js - * region_tag:dialogflow_v2_generated_EntityTypes_BatchDeleteEntities_async - */ - async checkBatchDeleteEntitiesProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchDeleteEntities, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listEntityTypes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listEntityTypes.createStream( - this.innerApiCalls.listEntityTypes as 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 include:samples/generated/v2/entity_types.list_entity_types.js - * region_tag:dialogflow_v2_generated_EntityTypes_ListEntityTypes_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listEntityTypes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listEntityTypes.asyncIterate( - this.innerApiCalls['listEntityTypes'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. The promise has a method named - * "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified conversationDataset resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_dataset - * @returns {string} Resource name string. - */ - conversationDatasetPath(project:string,location:string,conversationDataset:string) { - return this.pathTemplates.conversationDatasetPathTemplate.render({ - project: project, - location: location, - conversation_dataset: conversationDataset, - }); - } - - /** - * Parse the project from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; - } - - /** - * Parse the location from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; - } - - /** - * Parse the conversation_dataset from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the conversation_dataset. - */ - matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; - } - - /** - * 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 projectConversationModel resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectConversationModelPath(project:string,conversationModel:string) { - return this.pathTemplates.projectConversationModelPathTemplate.render({ - project: project, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ - project: project, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; - } - - /** - * 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 projectLocationConversationModel resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; - } - - /** - * Parse the location from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; - } - - /** - * Parse the location from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; - } - - /** - * 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 { - if (this.entityTypesStub && !this._terminated) { - return this.entityTypesStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/entity_types_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/entity_types_client_config.json deleted file mode 100644 index 55fa402652a..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/src/v2/entity_types_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/entity_types_proto_list.json deleted file mode 100644 index 15e06b6def0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/entity_types_proto_list.json +++ /dev/null @@ -1,25 +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_dataset.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/environments_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/environments_client.ts deleted file mode 100644 index 6f834177966..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/environments_client.ts +++ /dev/null @@ -1,3189 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new EnvironmentsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = { - conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' - ), - 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}' - ), - projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}' - ), - projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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}' - ), - projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' - ), - projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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 = this._gaxModule.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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2/environments.get_environment.js - * region_tag:dialogflow_v2_generated_Environments_GetEnvironment_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getEnvironment(request, options, callback); - } -/** - * 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 include:samples/generated/v2/environments.create_environment.js - * region_tag:dialogflow_v2_generated_Environments_CreateEnvironment_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createEnvironment(request, options, callback); - } -/** - * 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 include:samples/generated/v2/environments.update_environment.js - * region_tag:dialogflow_v2_generated_Environments_UpdateEnvironment_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'environment.name': request.environment!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateEnvironment(request, options, callback); - } -/** - * 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 include:samples/generated/v2/environments.delete_environment.js - * region_tag:dialogflow_v2_generated_Environments_DeleteEnvironment_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteEnvironment(request, options, callback); - } - - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listEnvironments']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listEnvironments.createStream( - this.innerApiCalls.listEnvironments as 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 include:samples/generated/v2/environments.list_environments.js - * region_tag:dialogflow_v2_generated_Environments_ListEnvironments_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listEnvironments']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listEnvironments.asyncIterate( - this.innerApiCalls['listEnvironments'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['getEnvironmentHistory']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.getEnvironmentHistory.createStream( - this.innerApiCalls.getEnvironmentHistory as 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 include:samples/generated/v2/environments.get_environment_history.js - * region_tag:dialogflow_v2_generated_Environments_GetEnvironmentHistory_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['getEnvironmentHistory']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.getEnvironmentHistory.asyncIterate( - this.innerApiCalls['getEnvironmentHistory'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified conversationDataset resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_dataset - * @returns {string} Resource name string. - */ - conversationDatasetPath(project:string,location:string,conversationDataset:string) { - return this.pathTemplates.conversationDatasetPathTemplate.render({ - project: project, - location: location, - conversation_dataset: conversationDataset, - }); - } - - /** - * Parse the project from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; - } - - /** - * Parse the location from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; - } - - /** - * Parse the conversation_dataset from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the conversation_dataset. - */ - matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; - } - - /** - * 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 projectConversationModel resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectConversationModelPath(project:string,conversationModel:string) { - return this.pathTemplates.projectConversationModelPathTemplate.render({ - project: project, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ - project: project, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; - } - - /** - * 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 projectLocationConversationModel resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; - } - - /** - * Parse the location from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; - } - - /** - * Parse the location from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; - } - - /** - * 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 { - if (this.environmentsStub && !this._terminated) { - return this.environmentsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/environments_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/environments_client_config.json deleted file mode 100644 index 30cdbacb873..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/src/v2/environments_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/environments_proto_list.json deleted file mode 100644 index 15e06b6def0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/environments_proto_list.json +++ /dev/null @@ -1,25 +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_dataset.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/fulfillments_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/fulfillments_client.ts deleted file mode 100644 index 10d96b38908..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/fulfillments_client.ts +++ /dev/null @@ -1,2589 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} 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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new FulfillmentsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = { - conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' - ), - 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}' - ), - projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}' - ), - projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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}' - ), - projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' - ), - projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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 = this._gaxModule.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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2/fulfillments.get_fulfillment.js - * region_tag:dialogflow_v2_generated_Fulfillments_GetFulfillment_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getFulfillment(request, options, callback); - } -/** - * 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 include:samples/generated/v2/fulfillments.update_fulfillment.js - * region_tag:dialogflow_v2_generated_Fulfillments_UpdateFulfillment_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'fulfillment.name': request.fulfillment!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateFulfillment(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified conversationDataset resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_dataset - * @returns {string} Resource name string. - */ - conversationDatasetPath(project:string,location:string,conversationDataset:string) { - return this.pathTemplates.conversationDatasetPathTemplate.render({ - project: project, - location: location, - conversation_dataset: conversationDataset, - }); - } - - /** - * Parse the project from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; - } - - /** - * Parse the location from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; - } - - /** - * Parse the conversation_dataset from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the conversation_dataset. - */ - matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; - } - - /** - * 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 projectConversationModel resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectConversationModelPath(project:string,conversationModel:string) { - return this.pathTemplates.projectConversationModelPathTemplate.render({ - project: project, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ - project: project, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; - } - - /** - * 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 projectLocationConversationModel resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; - } - - /** - * Parse the location from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; - } - - /** - * Parse the location from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; - } - - /** - * 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 { - if (this.fulfillmentsStub && !this._terminated) { - return this.fulfillmentsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/fulfillments_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/fulfillments_client_config.json deleted file mode 100644 index 615e86feb97..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/src/v2/fulfillments_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/fulfillments_proto_list.json deleted file mode 100644 index 15e06b6def0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/fulfillments_proto_list.json +++ /dev/null @@ -1,25 +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_dataset.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/gapic_metadata.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/gapic_metadata.json deleted file mode 100644 index 7065b59334f..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/gapic_metadata.json +++ /dev/null @@ -1,1329 +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" - ] - } - } - } - } - }, - "ConversationDatasets": { - "clients": { - "grpc": { - "libraryClient": "ConversationDatasetsClient", - "rpcs": { - "GetConversationDataset": { - "methods": [ - "getConversationDataset" - ] - }, - "CreateConversationDataset": { - "methods": [ - "createConversationDataset" - ] - }, - "DeleteConversationDataset": { - "methods": [ - "deleteConversationDataset" - ] - }, - "ImportConversationData": { - "methods": [ - "importConversationData" - ] - }, - "ListConversationDatasets": { - "methods": [ - "listConversationDatasets", - "listConversationDatasetsStream", - "listConversationDatasetsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ConversationDatasetsClient", - "rpcs": { - "GetConversationDataset": { - "methods": [ - "getConversationDataset" - ] - }, - "CreateConversationDataset": { - "methods": [ - "createConversationDataset" - ] - }, - "DeleteConversationDataset": { - "methods": [ - "deleteConversationDataset" - ] - }, - "ImportConversationData": { - "methods": [ - "importConversationData" - ] - }, - "ListConversationDatasets": { - "methods": [ - "listConversationDatasets", - "listConversationDatasetsStream", - "listConversationDatasetsAsync" - ] - } - } - } - } - }, - "ConversationModels": { - "clients": { - "grpc": { - "libraryClient": "ConversationModelsClient", - "rpcs": { - "GetConversationModel": { - "methods": [ - "getConversationModel" - ] - }, - "GetConversationModelEvaluation": { - "methods": [ - "getConversationModelEvaluation" - ] - }, - "CreateConversationModel": { - "methods": [ - "createConversationModel" - ] - }, - "DeleteConversationModel": { - "methods": [ - "deleteConversationModel" - ] - }, - "DeployConversationModel": { - "methods": [ - "deployConversationModel" - ] - }, - "UndeployConversationModel": { - "methods": [ - "undeployConversationModel" - ] - }, - "CreateConversationModelEvaluation": { - "methods": [ - "createConversationModelEvaluation" - ] - }, - "ListConversationModels": { - "methods": [ - "listConversationModels", - "listConversationModelsStream", - "listConversationModelsAsync" - ] - }, - "ListConversationModelEvaluations": { - "methods": [ - "listConversationModelEvaluations", - "listConversationModelEvaluationsStream", - "listConversationModelEvaluationsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ConversationModelsClient", - "rpcs": { - "GetConversationModel": { - "methods": [ - "getConversationModel" - ] - }, - "GetConversationModelEvaluation": { - "methods": [ - "getConversationModelEvaluation" - ] - }, - "CreateConversationModel": { - "methods": [ - "createConversationModel" - ] - }, - "DeleteConversationModel": { - "methods": [ - "deleteConversationModel" - ] - }, - "DeployConversationModel": { - "methods": [ - "deployConversationModel" - ] - }, - "UndeployConversationModel": { - "methods": [ - "undeployConversationModel" - ] - }, - "CreateConversationModelEvaluation": { - "methods": [ - "createConversationModelEvaluation" - ] - }, - "ListConversationModels": { - "methods": [ - "listConversationModels", - "listConversationModelsStream", - "listConversationModelsAsync" - ] - }, - "ListConversationModelEvaluations": { - "methods": [ - "listConversationModelEvaluations", - "listConversationModelEvaluationsStream", - "listConversationModelEvaluationsAsync" - ] - } - } - } - } - }, - "ConversationProfiles": { - "clients": { - "grpc": { - "libraryClient": "ConversationProfilesClient", - "rpcs": { - "GetConversationProfile": { - "methods": [ - "getConversationProfile" - ] - }, - "CreateConversationProfile": { - "methods": [ - "createConversationProfile" - ] - }, - "UpdateConversationProfile": { - "methods": [ - "updateConversationProfile" - ] - }, - "DeleteConversationProfile": { - "methods": [ - "deleteConversationProfile" - ] - }, - "SetSuggestionFeatureConfig": { - "methods": [ - "setSuggestionFeatureConfig" - ] - }, - "ClearSuggestionFeatureConfig": { - "methods": [ - "clearSuggestionFeatureConfig" - ] - }, - "ListConversationProfiles": { - "methods": [ - "listConversationProfiles", - "listConversationProfilesStream", - "listConversationProfilesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ConversationProfilesClient", - "rpcs": { - "GetConversationProfile": { - "methods": [ - "getConversationProfile" - ] - }, - "CreateConversationProfile": { - "methods": [ - "createConversationProfile" - ] - }, - "UpdateConversationProfile": { - "methods": [ - "updateConversationProfile" - ] - }, - "DeleteConversationProfile": { - "methods": [ - "deleteConversationProfile" - ] - }, - "SetSuggestionFeatureConfig": { - "methods": [ - "setSuggestionFeatureConfig" - ] - }, - "ClearSuggestionFeatureConfig": { - "methods": [ - "clearSuggestionFeatureConfig" - ] - }, - "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" - ] - }, - "ImportDocuments": { - "methods": [ - "importDocuments" - ] - }, - "DeleteDocument": { - "methods": [ - "deleteDocument" - ] - }, - "UpdateDocument": { - "methods": [ - "updateDocument" - ] - }, - "ReloadDocument": { - "methods": [ - "reloadDocument" - ] - }, - "ExportDocument": { - "methods": [ - "exportDocument" - ] - }, - "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" - ] - }, - "ExportDocument": { - "methods": [ - "exportDocument" - ] - }, - "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" - ] - }, - "StreamingAnalyzeContent": { - "methods": [ - "streamingAnalyzeContent" - ] - }, - "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" - ] - }, - "SuggestSmartReplies": { - "methods": [ - "suggestSmartReplies" - ] - }, - "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/google-cloud-dialogflow/v2/src/v2/index.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/index.ts deleted file mode 100644 index 2decccc0a50..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/index.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2022 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 {ConversationDatasetsClient} from './conversation_datasets_client'; -export {ConversationModelsClient} from './conversation_models_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/google-cloud-dialogflow/v2/src/v2/intents_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/intents_client.ts deleted file mode 100644 index df50bf6348b..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/intents_client.ts +++ /dev/null @@ -1,3477 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -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'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new IntentsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = { - conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' - ), - 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}' - ), - projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}' - ), - projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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}' - ), - projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' - ), - projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2/{name=projects/*/operations/*}:cancel',additional_bindings: [{post: '/v2/{name=projects/*/locations/*/operations/*}:cancel',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2/{name=projects/*/operations/*}',additional_bindings: [{get: '/v2/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2/{name=projects/*}/operations',additional_bindings: [{get: '/v2/{name=projects/*/locations/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).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 = this._gaxModule.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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2/intents.get_intent.js - * region_tag:dialogflow_v2_generated_Intents_GetIntent_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getIntent(request, options, callback); - } -/** - * 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 include:samples/generated/v2/intents.create_intent.js - * region_tag:dialogflow_v2_generated_Intents_CreateIntent_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createIntent(request, options, callback); - } -/** - * 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 include:samples/generated/v2/intents.update_intent.js - * region_tag:dialogflow_v2_generated_Intents_UpdateIntent_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'intent.name': request.intent!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateIntent(request, options, callback); - } -/** - * 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 include:samples/generated/v2/intents.delete_intent.js - * region_tag:dialogflow_v2_generated_Intents_DeleteIntent_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteIntent(request, options, callback); - } - -/** - * Updates/Creates multiple intents in the specified agent. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: An empty [Struct - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - * - `response`: {@link google.cloud.dialogflow.v2.BatchUpdateIntentsResponse|BatchUpdateIntentsResponse} - * - * 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 include:samples/generated/v2/intents.batch_update_intents.js - * region_tag:dialogflow_v2_generated_Intents_BatchUpdateIntents_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2/intents.batch_update_intents.js - * region_tag:dialogflow_v2_generated_Intents_BatchUpdateIntents_async - */ - async checkBatchUpdateIntentsProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchUpdateIntents, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes intents in the specified agent. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: An empty [Struct - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - * - `response`: An [Empty - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - * - * 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 include:samples/generated/v2/intents.batch_delete_intents.js - * region_tag:dialogflow_v2_generated_Intents_BatchDeleteIntents_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2/intents.batch_delete_intents.js - * region_tag:dialogflow_v2_generated_Intents_BatchDeleteIntents_async - */ - async checkBatchDeleteIntentsProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchDeleteIntents, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listIntents']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listIntents.createStream( - this.innerApiCalls.listIntents as 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 include:samples/generated/v2/intents.list_intents.js - * region_tag:dialogflow_v2_generated_Intents_ListIntents_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listIntents']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listIntents.asyncIterate( - this.innerApiCalls['listIntents'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. The promise has a method named - * "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified conversationDataset resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_dataset - * @returns {string} Resource name string. - */ - conversationDatasetPath(project:string,location:string,conversationDataset:string) { - return this.pathTemplates.conversationDatasetPathTemplate.render({ - project: project, - location: location, - conversation_dataset: conversationDataset, - }); - } - - /** - * Parse the project from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; - } - - /** - * Parse the location from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; - } - - /** - * Parse the conversation_dataset from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the conversation_dataset. - */ - matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; - } - - /** - * 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 projectConversationModel resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectConversationModelPath(project:string,conversationModel:string) { - return this.pathTemplates.projectConversationModelPathTemplate.render({ - project: project, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ - project: project, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; - } - - /** - * 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 projectLocationConversationModel resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; - } - - /** - * Parse the location from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; - } - - /** - * Parse the location from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; - } - - /** - * 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 { - if (this.intentsStub && !this._terminated) { - return this.intentsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/intents_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/intents_client_config.json deleted file mode 100644 index ad20f4c607d..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/src/v2/intents_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/intents_proto_list.json deleted file mode 100644 index 15e06b6def0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/intents_proto_list.json +++ /dev/null @@ -1,25 +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_dataset.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/knowledge_bases_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/knowledge_bases_client.ts deleted file mode 100644 index daf20fca10a..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/knowledge_bases_client.ts +++ /dev/null @@ -1,3036 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new KnowledgeBasesClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = { - conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' - ), - 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}' - ), - projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}' - ), - projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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}' - ), - projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' - ), - projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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 = this._gaxModule.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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2/knowledge_bases.get_knowledge_base.js - * region_tag:dialogflow_v2_generated_KnowledgeBases_GetKnowledgeBase_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getKnowledgeBase(request, options, callback); - } -/** - * 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 include:samples/generated/v2/knowledge_bases.create_knowledge_base.js - * region_tag:dialogflow_v2_generated_KnowledgeBases_CreateKnowledgeBase_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createKnowledgeBase(request, options, callback); - } -/** - * 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 include:samples/generated/v2/knowledge_bases.delete_knowledge_base.js - * region_tag:dialogflow_v2_generated_KnowledgeBases_DeleteKnowledgeBase_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteKnowledgeBase(request, options, callback); - } -/** - * 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 include:samples/generated/v2/knowledge_bases.update_knowledge_base.js - * region_tag:dialogflow_v2_generated_KnowledgeBases_UpdateKnowledgeBase_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'knowledge_base.name': request.knowledgeBase!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateKnowledgeBase(request, options, callback); - } - - /** - * 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 {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.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, - 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; - 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' - ] = this._gaxModule.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.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listKnowledgeBases']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listKnowledgeBases.createStream( - this.innerApiCalls.listKnowledgeBases as 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.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 include:samples/generated/v2/knowledge_bases.list_knowledge_bases.js - * region_tag:dialogflow_v2_generated_KnowledgeBases_ListKnowledgeBases_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listKnowledgeBases']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listKnowledgeBases.asyncIterate( - this.innerApiCalls['listKnowledgeBases'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified conversationDataset resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_dataset - * @returns {string} Resource name string. - */ - conversationDatasetPath(project:string,location:string,conversationDataset:string) { - return this.pathTemplates.conversationDatasetPathTemplate.render({ - project: project, - location: location, - conversation_dataset: conversationDataset, - }); - } - - /** - * Parse the project from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; - } - - /** - * Parse the location from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; - } - - /** - * Parse the conversation_dataset from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the conversation_dataset. - */ - matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; - } - - /** - * 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 projectConversationModel resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectConversationModelPath(project:string,conversationModel:string) { - return this.pathTemplates.projectConversationModelPathTemplate.render({ - project: project, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ - project: project, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; - } - - /** - * 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 projectLocationConversationModel resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; - } - - /** - * Parse the location from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; - } - - /** - * Parse the location from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; - } - - /** - * 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 { - if (this.knowledgeBasesStub && !this._terminated) { - return this.knowledgeBasesStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/knowledge_bases_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/knowledge_bases_client_config.json deleted file mode 100644 index 580ef4d8686..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/src/v2/knowledge_bases_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/knowledge_bases_proto_list.json deleted file mode 100644 index 15e06b6def0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/knowledge_bases_proto_list.json +++ /dev/null @@ -1,25 +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_dataset.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/participants_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/participants_client.ts deleted file mode 100644 index 635963d00b8..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/participants_client.ts +++ /dev/null @@ -1,3294 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform, PassThrough} from 'stream'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new ParticipantsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = { - conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' - ), - 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}' - ), - projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}' - ), - projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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}' - ), - projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' - ), - projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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') - }; - - // Some of the methods on this service provide streaming responses. - // Provide descriptors for these. - this.descriptors.stream = { - streamingAnalyzeContent: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, opts.fallback === 'rest') - }; - - // 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 = this._gaxModule.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', 'streamingAnalyzeContent', 'suggestArticles', 'suggestFaqAnswers', 'suggestSmartReplies']; - for (const methodName of participantsStubMethods) { - const callPromise = this.participantsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough(); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; - } - 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.stream[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2/participants.create_participant.js - * region_tag:dialogflow_v2_generated_Participants_CreateParticipant_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createParticipant(request, options, callback); - } -/** - * 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 include:samples/generated/v2/participants.get_participant.js - * region_tag:dialogflow_v2_generated_Participants_GetParticipant_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getParticipant(request, options, callback); - } -/** - * 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 include:samples/generated/v2/participants.update_participant.js - * region_tag:dialogflow_v2_generated_Participants_UpdateParticipant_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'participant.name': request.participant!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateParticipant(request, options, callback); - } -/** - * 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 {google.cloud.dialogflow.v2.AssistQueryParameters} request.assistQueryParams - * Parameters for a human assist query. - * @param {google.protobuf.Struct} request.cxParameters - * Additional parameters to be put into Dialogflow CX session parameters. To - * remove a parameter from the session, clients should explicitly set the - * parameter value to null. - * - * Note: this field should only be used if you are connecting to a Dialogflow - * CX agent. - * @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 include:samples/generated/v2/participants.analyze_content.js - * region_tag:dialogflow_v2_generated_Participants_AnalyzeContent_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'participant': request.participant ?? '', - }); - this.initialize(); - return this.innerApiCalls.analyzeContent(request, options, callback); - } -/** - * 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] - * 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.v2.SuggestArticlesRequest.latest_message|latest_message} to use as context - * when compiling the suggestion. By default 20 and at most 50. - * @param {google.cloud.dialogflow.v2.AssistQueryParameters} request.assistQueryParams - * Parameters for a human assist query. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2/participants.suggest_articles.js - * region_tag:dialogflow_v2_generated_Participants_SuggestArticles_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.suggestArticles(request, options, callback); - } -/** - * 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 {google.cloud.dialogflow.v2.AssistQueryParameters} request.assistQueryParams - * Parameters for a human assist query. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2/participants.suggest_faq_answers.js - * region_tag:dialogflow_v2_generated_Participants_SuggestFaqAnswers_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.suggestFaqAnswers(request, options, callback); - } -/** - * 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.v2.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 - * 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.v2.SuggestSmartRepliesResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2/participants.suggest_smart_replies.js - * region_tag:dialogflow_v2_generated_Participants_SuggestSmartReplies_async - */ - suggestSmartReplies( - request?: protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse, - protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest|undefined, {}|undefined - ]>; - suggestSmartReplies( - request: protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse, - protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest|null|undefined, - {}|null|undefined>): void; - suggestSmartReplies( - request: protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse, - protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest|null|undefined, - {}|null|undefined>): void; - suggestSmartReplies( - request?: protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse, - protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse, - protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse, - protos.google.cloud.dialogflow.v2.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.suggestSmartReplies(request, options, callback); - } - -/** - * Adds a text (chat, for example), or audio (phone recording, for example) - * message from a participant into the conversation. - * Note: This method is only available through the gRPC API (not REST). - * - * The top-level message sent to the client by the server is - * `StreamingAnalyzeContentResponse`. Multiple response messages can be - * returned in order. The first one or more messages contain the - * `recognition_result` field. Each result represents a more complete - * transcript of what the user said. The next message contains the - * `reply_text` field and potentially the `reply_audio` field. The message can - * also contain the `automated_agent_reply` field. - * - * 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} [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 [StreamingAnalyzeContentRequest]{@link google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest} for write() method, and - * will emit objects representing [StreamingAnalyzeContentResponse]{@link google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse} 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 include:samples/generated/v2/participants.streaming_analyze_content.js - * region_tag:dialogflow_v2_generated_Participants_StreamingAnalyzeContent_async - */ - streamingAnalyzeContent( - options?: CallOptions): - gax.CancellableStream { - this.initialize(); - return this.innerApiCalls.streamingAnalyzeContent(null, options); - } - - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listParticipants']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listParticipants.createStream( - this.innerApiCalls.listParticipants as 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 include:samples/generated/v2/participants.list_participants.js - * region_tag:dialogflow_v2_generated_Participants_ListParticipants_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listParticipants']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listParticipants.asyncIterate( - this.innerApiCalls['listParticipants'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified conversationDataset resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_dataset - * @returns {string} Resource name string. - */ - conversationDatasetPath(project:string,location:string,conversationDataset:string) { - return this.pathTemplates.conversationDatasetPathTemplate.render({ - project: project, - location: location, - conversation_dataset: conversationDataset, - }); - } - - /** - * Parse the project from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; - } - - /** - * Parse the location from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; - } - - /** - * Parse the conversation_dataset from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the conversation_dataset. - */ - matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; - } - - /** - * 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 projectConversationModel resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectConversationModelPath(project:string,conversationModel:string) { - return this.pathTemplates.projectConversationModelPathTemplate.render({ - project: project, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ - project: project, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; - } - - /** - * 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 projectLocationConversationModel resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; - } - - /** - * Parse the location from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; - } - - /** - * Parse the location from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; - } - - /** - * 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 { - if (this.participantsStub && !this._terminated) { - return this.participantsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/participants_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/participants_client_config.json deleted file mode 100644 index e81ecec6eea..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/participants_client_config.json +++ /dev/null @@ -1,74 +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" - }, - "StreamingAnalyzeContent": { - "timeout_millis": 220000, - "retry_codes_name": "non_idempotent", - "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" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/participants_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/participants_proto_list.json deleted file mode 100644 index 15e06b6def0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/participants_proto_list.json +++ /dev/null @@ -1,25 +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_dataset.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/session_entity_types_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/session_entity_types_client.ts deleted file mode 100644 index caf93d317c2..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/session_entity_types_client.ts +++ /dev/null @@ -1,3036 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SessionEntityTypesClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = { - conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' - ), - 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}' - ), - projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}' - ), - projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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}' - ), - projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' - ), - projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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 = this._gaxModule.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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2/session_entity_types.get_session_entity_type.js - * region_tag:dialogflow_v2_generated_SessionEntityTypes_GetSessionEntityType_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getSessionEntityType(request, options, callback); - } -/** - * 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 include:samples/generated/v2/session_entity_types.create_session_entity_type.js - * region_tag:dialogflow_v2_generated_SessionEntityTypes_CreateSessionEntityType_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createSessionEntityType(request, options, callback); - } -/** - * 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 include:samples/generated/v2/session_entity_types.update_session_entity_type.js - * region_tag:dialogflow_v2_generated_SessionEntityTypes_UpdateSessionEntityType_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'session_entity_type.name': request.sessionEntityType!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateSessionEntityType(request, options, callback); - } -/** - * 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 include:samples/generated/v2/session_entity_types.delete_session_entity_type.js - * region_tag:dialogflow_v2_generated_SessionEntityTypes_DeleteSessionEntityType_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteSessionEntityType(request, options, callback); - } - - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSessionEntityTypes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSessionEntityTypes.createStream( - this.innerApiCalls.listSessionEntityTypes as 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 include:samples/generated/v2/session_entity_types.list_session_entity_types.js - * region_tag:dialogflow_v2_generated_SessionEntityTypes_ListSessionEntityTypes_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSessionEntityTypes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSessionEntityTypes.asyncIterate( - this.innerApiCalls['listSessionEntityTypes'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified conversationDataset resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_dataset - * @returns {string} Resource name string. - */ - conversationDatasetPath(project:string,location:string,conversationDataset:string) { - return this.pathTemplates.conversationDatasetPathTemplate.render({ - project: project, - location: location, - conversation_dataset: conversationDataset, - }); - } - - /** - * Parse the project from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; - } - - /** - * Parse the location from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; - } - - /** - * Parse the conversation_dataset from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the conversation_dataset. - */ - matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; - } - - /** - * 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 projectConversationModel resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectConversationModelPath(project:string,conversationModel:string) { - return this.pathTemplates.projectConversationModelPathTemplate.render({ - project: project, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ - project: project, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; - } - - /** - * 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 projectLocationConversationModel resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; - } - - /** - * Parse the location from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; - } - - /** - * Parse the location from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; - } - - /** - * 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 { - if (this.sessionEntityTypesStub && !this._terminated) { - return this.sessionEntityTypesStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/session_entity_types_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/session_entity_types_client_config.json deleted file mode 100644 index 52a412a1243..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/src/v2/session_entity_types_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/session_entity_types_proto_list.json deleted file mode 100644 index 15e06b6def0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/session_entity_types_proto_list.json +++ /dev/null @@ -1,25 +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_dataset.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/sessions_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/sessions_client.ts deleted file mode 100644 index fcbc5cbb62e..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/sessions_client.ts +++ /dev/null @@ -1,2856 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} from 'google-gax'; -import {PassThrough} from 'stream'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SessionsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = { - conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' - ), - 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}' - ), - projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}' - ), - projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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}' - ), - projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' - ), - projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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(this._gaxModule.StreamType.BIDI_STREAMING, opts.fallback === 'rest') - }; - - // 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 = this._gaxModule.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) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough(); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; - } - 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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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. - * - * If you might use - * [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) - * or other CCAI products now or in the future, consider using - * {@link google.cloud.dialogflow.v2.Participants.AnalyzeContent|AnalyzeContent} - * instead of `DetectIntent`. `AnalyzeContent` has additional - * functionality for Agent Assist and other CCAI products. - * - * 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 include:samples/generated/v2/sessions.detect_intent.js - * region_tag:dialogflow_v2_generated_Sessions_DetectIntent_async - */ - 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; - 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' - ] = this._gaxModule.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). - * - * If you might use - * [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) - * or other CCAI products now or in the future, consider using - * {@link google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent|StreamingAnalyzeContent} - * instead of `StreamingDetectIntent`. `StreamingAnalyzeContent` has - * additional functionality for Agent Assist and other CCAI products. - * - * 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 include:samples/generated/v2/sessions.streaming_detect_intent.js - * region_tag:dialogflow_v2_generated_Sessions_StreamingDetectIntent_async - */ - streamingDetectIntent( - options?: CallOptions): - gax.CancellableStream { - this.initialize(); - return this.innerApiCalls.streamingDetectIntent(null, options); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified conversationDataset resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_dataset - * @returns {string} Resource name string. - */ - conversationDatasetPath(project:string,location:string,conversationDataset:string) { - return this.pathTemplates.conversationDatasetPathTemplate.render({ - project: project, - location: location, - conversation_dataset: conversationDataset, - }); - } - - /** - * Parse the project from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; - } - - /** - * Parse the location from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; - } - - /** - * Parse the conversation_dataset from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the conversation_dataset. - */ - matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; - } - - /** - * 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 projectConversationModel resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectConversationModelPath(project:string,conversationModel:string) { - return this.pathTemplates.projectConversationModelPathTemplate.render({ - project: project, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ - project: project, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; - } - - /** - * 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 projectLocationConversationModel resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; - } - - /** - * Parse the location from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; - } - - /** - * Parse the location from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; - } - - /** - * 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 { - if (this.sessionsStub && !this._terminated) { - return this.sessionsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/sessions_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/sessions_client_config.json deleted file mode 100644 index b9c1b92dab2..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/src/v2/sessions_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/sessions_proto_list.json deleted file mode 100644 index 15e06b6def0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/sessions_proto_list.json +++ /dev/null @@ -1,25 +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_dataset.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/src/v2/versions_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/versions_client.ts deleted file mode 100644 index ec0b2e44719..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/versions_client.ts +++ /dev/null @@ -1,2979 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new VersionsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = { - conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' - ), - 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}' - ), - projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}' - ), - projectConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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}' - ), - projectLocationConversationModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' - ), - projectLocationConversationModelEvaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' - ), - 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 = this._gaxModule.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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2/versions.get_version.js - * region_tag:dialogflow_v2_generated_Versions_GetVersion_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getVersion(request, options, callback); - } -/** - * 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 include:samples/generated/v2/versions.create_version.js - * region_tag:dialogflow_v2_generated_Versions_CreateVersion_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createVersion(request, options, callback); - } -/** - * 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 include:samples/generated/v2/versions.update_version.js - * region_tag:dialogflow_v2_generated_Versions_UpdateVersion_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'version.name': request.version!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateVersion(request, options, callback); - } -/** - * 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 include:samples/generated/v2/versions.delete_version.js - * region_tag:dialogflow_v2_generated_Versions_DeleteVersion_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteVersion(request, options, callback); - } - - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listVersions.createStream( - this.innerApiCalls.listVersions as 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 include:samples/generated/v2/versions.list_versions.js - * region_tag:dialogflow_v2_generated_Versions_ListVersions_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listVersions.asyncIterate( - this.innerApiCalls['listVersions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified conversationDataset resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_dataset - * @returns {string} Resource name string. - */ - conversationDatasetPath(project:string,location:string,conversationDataset:string) { - return this.pathTemplates.conversationDatasetPathTemplate.render({ - project: project, - location: location, - conversation_dataset: conversationDataset, - }); - } - - /** - * Parse the project from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).project; - } - - /** - * Parse the location from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).location; - } - - /** - * Parse the conversation_dataset from ConversationDataset resource. - * - * @param {string} conversationDatasetName - * A fully-qualified path representing ConversationDataset resource. - * @returns {string} A string representing the conversation_dataset. - */ - matchConversationDatasetFromConversationDatasetName(conversationDatasetName: string) { - return this.pathTemplates.conversationDatasetPathTemplate.match(conversationDatasetName).conversation_dataset; - } - - /** - * 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 projectConversationModel resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectConversationModelPath(project:string,conversationModel:string) { - return this.pathTemplates.projectConversationModelPathTemplate.render({ - project: project, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModel resource. - * - * @param {string} projectConversationModelName - * A fully-qualified path representing project_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelName(projectConversationModelName: string) { - return this.pathTemplates.projectConversationModelPathTemplate.match(projectConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectConversationModelEvaluationPath(project:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render({ - project: project, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).project; - } - - /** - * Parse the conversation_model from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectConversationModelEvaluation resource. - * - * @param {string} projectConversationModelEvaluationName - * A fully-qualified path representing project_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectConversationModelEvaluationName(projectConversationModelEvaluationName: string) { - return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match(projectConversationModelEvaluationName).evaluation; - } - - /** - * 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 projectLocationConversationModel resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @returns {string} Resource name string. - */ - projectLocationConversationModelPath(project:string,location:string,conversationModel:string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - }); - } - - /** - * Parse the project from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).project; - } - - /** - * Parse the location from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModel resource. - * - * @param {string} projectLocationConversationModelName - * A fully-qualified path representing project_location_conversation_model resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelName(projectLocationConversationModelName: string) { - return this.pathTemplates.projectLocationConversationModelPathTemplate.match(projectLocationConversationModelName).conversation_model; - } - - /** - * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation_model - * @param {string} evaluation - * @returns {string} Resource name string. - */ - projectLocationConversationModelEvaluationPath(project:string,location:string,conversationModel:string,evaluation:string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render({ - project: project, - location: location, - conversation_model: conversationModel, - evaluation: evaluation, - }); - } - - /** - * Parse the project from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).project; - } - - /** - * Parse the location from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).location; - } - - /** - * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the conversation_model. - */ - matchConversationModelFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).conversation_model; - } - - /** - * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. - * - * @param {string} projectLocationConversationModelEvaluationName - * A fully-qualified path representing project_location_conversation_model_evaluation resource. - * @returns {string} A string representing the evaluation. - */ - matchEvaluationFromProjectLocationConversationModelEvaluationName(projectLocationConversationModelEvaluationName: string) { - return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match(projectLocationConversationModelEvaluationName).evaluation; - } - - /** - * 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 { - if (this.versionsStub && !this._terminated) { - return this.versionsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/versions_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/versions_client_config.json deleted file mode 100644 index db17e434d96..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/src/v2/versions_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/versions_proto_list.json deleted file mode 100644 index 15e06b6def0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/src/v2/versions_proto_list.json +++ /dev/null @@ -1,25 +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_dataset.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", - "../../protos/google/cloud/dialogflow/v2/conversation_model.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/google-cloud-dialogflow/v2/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-dialogflow/v2/system-test/fixtures/sample/src/index.js deleted file mode 100644 index e198f451416..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2022 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 conversationDatasetsClient = new dialogflow.ConversationDatasetsClient(); - const conversationModelsClient = new dialogflow.ConversationModelsClient(); - 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/google-cloud-dialogflow/v2/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-dialogflow/v2/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index c7cb97490ef..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright 2022 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, ConversationDatasetsClient, ConversationModelsClient, 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 doStuffWithConversationDatasetsClient(client: ConversationDatasetsClient) { - client.close(); -} -function doStuffWithConversationModelsClient(client: ConversationModelsClient) { - 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 conversationDatasetsClient = new ConversationDatasetsClient(); - doStuffWithConversationDatasetsClient(conversationDatasetsClient); - // check that the client instance can be created - const conversationModelsClient = new ConversationModelsClient(); - doStuffWithConversationModelsClient(conversationModelsClient); - // 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/google-cloud-dialogflow/v2/system-test/install.ts b/owl-bot-staging/google-cloud-dialogflow/v2/system-test/install.ts deleted file mode 100644 index 557a57558e1..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 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/google-cloud-dialogflow/v2/test/gapic_agents_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_agents_v2.ts deleted file mode 100644 index 4fbb1d84759..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_agents_v2.ts +++ /dev/null @@ -1,3766 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.agentsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.agentsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAgent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAgent(request), expectedError); - const actualRequest = (client.innerApiCalls.getAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAgent with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getAgent(request), expectedError); - }); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SetAgentRequest', ['agent', 'parent']); - request.agent.parent = defaultValue1; - const expectedHeaderRequestParams = `agent.parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.setAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SetAgentRequest', ['agent', 'parent']); - request.agent.parent = defaultValue1; - const expectedHeaderRequestParams = `agent.parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.setAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SetAgentRequest', ['agent', 'parent']); - request.agent.parent = defaultValue1; - const expectedHeaderRequestParams = `agent.parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setAgent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setAgent(request), expectedError); - const actualRequest = (client.innerApiCalls.setAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setAgent with closed client', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SetAgentRequest', ['agent', 'parent']); - request.agent.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setAgent(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteAgent = stubSimpleCall(expectedResponse); - const [response] = await client.deleteAgent(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.deleteAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAgent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteAgent(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAgent with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteAgent(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetValidationResultRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getValidationResult as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getValidationResult as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetValidationResultRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getValidationResult as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getValidationResult as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetValidationResultRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getValidationResult = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getValidationResult(request), expectedError); - const actualRequest = (client.innerApiCalls.getValidationResult as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getValidationResult as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getValidationResult with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetValidationResultRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getValidationResult(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.TrainAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.trainAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.trainAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.TrainAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.trainAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.trainAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.TrainAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.trainAgent = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.trainAgent(request), expectedError); - const actualRequest = (client.innerApiCalls.trainAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.trainAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.TrainAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.trainAgent = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.trainAgent(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.trainAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.trainAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ExportAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.exportAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ExportAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.exportAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ExportAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportAgent = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.exportAgent(request), expectedError); - const actualRequest = (client.innerApiCalls.exportAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ExportAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportAgent = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.exportAgent(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.exportAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ImportAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.importAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ImportAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.importAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ImportAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importAgent = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.importAgent(request), expectedError); - const actualRequest = (client.innerApiCalls.importAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ImportAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importAgent = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.importAgent(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.importAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.RestoreAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.restoreAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.RestoreAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.restoreAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.RestoreAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreAgent = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.restoreAgent(request), expectedError); - const actualRequest = (client.innerApiCalls.restoreAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.RestoreAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreAgent = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.restoreAgent(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.restoreAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SearchAgentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.searchAgents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAgents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SearchAgentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.searchAgents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAgents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SearchAgentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.searchAgents = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.searchAgents(request), expectedError); - const actualRequest = (client.innerApiCalls.searchAgents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAgents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SearchAgentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.searchAgents.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SearchAgentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.searchAgents.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SearchAgentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.searchAgents.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SearchAgentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.searchAgents.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('conversationDataset', () => { - const fakePath = "/rendered/path/conversationDataset"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_dataset: "conversationDatasetValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.conversationDatasetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.conversationDatasetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('conversationDatasetPath', () => { - const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConversationDatasetName', () => { - const result = client.matchProjectFromConversationDatasetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConversationDatasetName', () => { - const result = client.matchLocationFromConversationDatasetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationDatasetFromConversationDatasetName', () => { - const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); - assert.strictEqual(result, "conversationDatasetValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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('projectConversationModel', () => { - const fakePath = "/rendered/path/projectConversationModel"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelPath', () => { - const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelName', () => { - const result = client.matchProjectFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelName', () => { - const result = client.matchConversationModelFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelEvaluationPath', () => { - const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { - const fakePath = "/rendered/path/projectLocationConversationModel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelPath', () => { - const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelName', () => { - const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelName', () => { - const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new agentsModule.v2.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelEvaluationPath', () => { - const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_answer_records_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_answer_records_v2.ts deleted file mode 100644 index f0d1d2454cc..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_answer_records_v2.ts +++ /dev/null @@ -1,2555 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.answerRecordsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.answerRecordsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest', ['answerRecord', 'name']); - request.answerRecord.name = defaultValue1; - const expectedHeaderRequestParams = `answer_record.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateAnswerRecord as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAnswerRecord as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest', ['answerRecord', 'name']); - request.answerRecord.name = defaultValue1; - const expectedHeaderRequestParams = `answer_record.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateAnswerRecord as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAnswerRecord as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest', ['answerRecord', 'name']); - request.answerRecord.name = defaultValue1; - const expectedHeaderRequestParams = `answer_record.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAnswerRecord = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateAnswerRecord(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAnswerRecord as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAnswerRecord as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAnswerRecord with closed client', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest', ['answerRecord', 'name']); - request.answerRecord.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateAnswerRecord(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListAnswerRecordsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listAnswerRecords as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAnswerRecords as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListAnswerRecordsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listAnswerRecords as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAnswerRecords as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListAnswerRecordsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAnswerRecords = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAnswerRecords(request), expectedError); - const actualRequest = (client.innerApiCalls.listAnswerRecords as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAnswerRecords as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListAnswerRecordsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listAnswerRecords.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListAnswerRecordsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listAnswerRecords.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListAnswerRecordsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListAnswerRecordsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('conversationDataset', () => { - const fakePath = "/rendered/path/conversationDataset"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_dataset: "conversationDatasetValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.conversationDatasetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.conversationDatasetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('conversationDatasetPath', () => { - const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConversationDatasetName', () => { - const result = client.matchProjectFromConversationDatasetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConversationDatasetName', () => { - const result = client.matchLocationFromConversationDatasetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationDatasetFromConversationDatasetName', () => { - const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); - assert.strictEqual(result, "conversationDatasetValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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('projectConversationModel', () => { - const fakePath = "/rendered/path/projectConversationModel"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelPath', () => { - const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelName', () => { - const result = client.matchProjectFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelName', () => { - const result = client.matchConversationModelFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelEvaluationPath', () => { - const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { - const fakePath = "/rendered/path/projectLocationConversationModel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelPath', () => { - const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelName', () => { - const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelName', () => { - const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new answerrecordsModule.v2.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelEvaluationPath', () => { - const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_contexts_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_contexts_v2.ts deleted file mode 100644 index d5137f233d0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_contexts_v2.ts +++ /dev/null @@ -1,3025 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.contextsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.contextsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetContextRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getContext as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getContext as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetContextRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getContext as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getContext as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetContextRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getContext = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getContext(request), expectedError); - const actualRequest = (client.innerApiCalls.getContext as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getContext as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getContext with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetContextRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getContext(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateContextRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createContext as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createContext as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateContextRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createContext as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createContext as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateContextRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createContext = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createContext(request), expectedError); - const actualRequest = (client.innerApiCalls.createContext as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createContext as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createContext with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateContextRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createContext(request), expectedError); - }); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateContextRequest', ['context', 'name']); - request.context.name = defaultValue1; - const expectedHeaderRequestParams = `context.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateContext as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateContext as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateContextRequest', ['context', 'name']); - request.context.name = defaultValue1; - const expectedHeaderRequestParams = `context.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateContext as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateContext as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateContextRequest', ['context', 'name']); - request.context.name = defaultValue1; - const expectedHeaderRequestParams = `context.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateContext = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateContext(request), expectedError); - const actualRequest = (client.innerApiCalls.updateContext as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateContext as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateContext with closed client', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateContextRequest', ['context', 'name']); - request.context.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateContext(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteContextRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteContext = stubSimpleCall(expectedResponse); - const [response] = await client.deleteContext(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteContext as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteContext as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteContextRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.deleteContext as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteContext as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteContextRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteContext = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteContext(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteContext as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteContext as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteContext with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteContextRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteContext(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteAllContextsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteAllContexts = stubSimpleCall(expectedResponse); - const [response] = await client.deleteAllContexts(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAllContexts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAllContexts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteAllContextsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.deleteAllContexts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAllContexts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteAllContextsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAllContexts = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteAllContexts(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAllContexts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAllContexts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAllContexts with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteAllContextsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteAllContexts(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListContextsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listContexts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listContexts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListContextsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listContexts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listContexts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListContextsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listContexts = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listContexts(request), expectedError); - const actualRequest = (client.innerApiCalls.listContexts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listContexts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListContextsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listContexts.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListContextsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listContexts.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListContextsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listContexts.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListContextsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listContexts.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('conversationDataset', () => { - const fakePath = "/rendered/path/conversationDataset"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_dataset: "conversationDatasetValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.conversationDatasetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.conversationDatasetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('conversationDatasetPath', () => { - const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConversationDatasetName', () => { - const result = client.matchProjectFromConversationDatasetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConversationDatasetName', () => { - const result = client.matchLocationFromConversationDatasetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationDatasetFromConversationDatasetName', () => { - const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); - assert.strictEqual(result, "conversationDatasetValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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('projectConversationModel', () => { - const fakePath = "/rendered/path/projectConversationModel"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelPath', () => { - const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelName', () => { - const result = client.matchProjectFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelName', () => { - const result = client.matchConversationModelFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelEvaluationPath', () => { - const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { - const fakePath = "/rendered/path/projectLocationConversationModel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelPath', () => { - const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelName', () => { - const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelName', () => { - const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new contextsModule.v2.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelEvaluationPath', () => { - const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_conversation_datasets_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_conversation_datasets_v2.ts deleted file mode 100644 index 621794d6411..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_conversation_datasets_v2.ts +++ /dev/null @@ -1,3322 +0,0 @@ -// Copyright 2022 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 conversationdatasetsModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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.ConversationDatasetsClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = conversationdatasetsModule.v2.ConversationDatasetsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = conversationdatasetsModule.v2.ConversationDatasetsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = conversationdatasetsModule.v2.ConversationDatasetsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.conversationDatasetsStub, undefined); - await client.initialize(); - assert(client.conversationDatasetsStub); - }); - - it('has close method for the initialized client', done => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.conversationDatasetsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.conversationDatasetsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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('getConversationDataset', () => { - it('invokes getConversationDataset without error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.GetConversationDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationDatasetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ConversationDataset() - ); - client.innerApiCalls.getConversationDataset = stubSimpleCall(expectedResponse); - const [response] = await client.getConversationDataset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConversationDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConversationDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConversationDataset without error using callback', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.GetConversationDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationDatasetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ConversationDataset() - ); - client.innerApiCalls.getConversationDataset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getConversationDataset( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversationDataset|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConversationDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConversationDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConversationDataset with error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.GetConversationDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationDatasetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getConversationDataset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getConversationDataset(request), expectedError); - const actualRequest = (client.innerApiCalls.getConversationDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConversationDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConversationDataset with closed client', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.GetConversationDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationDatasetRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getConversationDataset(request), expectedError); - }); - }); - - describe('createConversationDataset', () => { - it('invokes createConversationDataset without error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.CreateConversationDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationDatasetRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createConversationDataset = stubLongRunningCall(expectedResponse); - const [operation] = await client.createConversationDataset(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createConversationDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConversationDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConversationDataset without error using callback', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.CreateConversationDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationDatasetRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createConversationDataset = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createConversationDataset( - 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); - const actualRequest = (client.innerApiCalls.createConversationDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConversationDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConversationDataset with call error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.CreateConversationDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationDatasetRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConversationDataset = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createConversationDataset(request), expectedError); - const actualRequest = (client.innerApiCalls.createConversationDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConversationDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConversationDataset with LRO error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.CreateConversationDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationDatasetRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConversationDataset = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createConversationDataset(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createConversationDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConversationDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateConversationDatasetProgress without error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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.checkCreateConversationDatasetProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateConversationDatasetProgress with error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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.checkCreateConversationDatasetProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteConversationDataset', () => { - it('invokes deleteConversationDataset without error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteConversationDataset = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteConversationDataset(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteConversationDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConversationDataset without error using callback', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteConversationDataset = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteConversationDataset( - 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); - const actualRequest = (client.innerApiCalls.deleteConversationDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConversationDataset with call error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConversationDataset = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteConversationDataset(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteConversationDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConversationDataset with LRO error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConversationDataset = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteConversationDataset(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteConversationDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteConversationDatasetProgress without error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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.checkDeleteConversationDatasetProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteConversationDatasetProgress with error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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.checkDeleteConversationDatasetProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('importConversationData', () => { - it('invokes importConversationData without error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ImportConversationDataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ImportConversationDataRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importConversationData = stubLongRunningCall(expectedResponse); - const [operation] = await client.importConversationData(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importConversationData as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importConversationData as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importConversationData without error using callback', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ImportConversationDataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ImportConversationDataRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importConversationData = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importConversationData( - 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); - const actualRequest = (client.innerApiCalls.importConversationData as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importConversationData as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importConversationData with call error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ImportConversationDataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ImportConversationDataRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importConversationData = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.importConversationData(request), expectedError); - const actualRequest = (client.innerApiCalls.importConversationData as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importConversationData as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importConversationData with LRO error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ImportConversationDataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ImportConversationDataRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importConversationData = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.importConversationData(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.importConversationData as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importConversationData as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkImportConversationDataProgress without error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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.checkImportConversationDataProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkImportConversationDataProgress with error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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.checkImportConversationDataProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listConversationDatasets', () => { - it('invokes listConversationDatasets without error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ListConversationDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationDatasetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationDataset()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationDataset()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationDataset()), - ]; - client.innerApiCalls.listConversationDatasets = stubSimpleCall(expectedResponse); - const [response] = await client.listConversationDatasets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listConversationDatasets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConversationDatasets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConversationDatasets without error using callback', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ListConversationDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationDatasetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationDataset()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationDataset()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationDataset()), - ]; - client.innerApiCalls.listConversationDatasets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listConversationDatasets( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversationDataset[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listConversationDatasets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConversationDatasets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConversationDatasets with error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ListConversationDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationDatasetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listConversationDatasets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listConversationDatasets(request), expectedError); - const actualRequest = (client.innerApiCalls.listConversationDatasets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConversationDatasets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConversationDatasetsStream without error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ListConversationDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationDatasetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationDataset()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationDataset()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationDataset()), - ]; - client.descriptors.page.listConversationDatasets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listConversationDatasetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.ConversationDataset[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.ConversationDataset) => { - 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.listConversationDatasets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConversationDatasets, request)); - assert( - (client.descriptors.page.listConversationDatasets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listConversationDatasetsStream with error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ListConversationDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationDatasetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listConversationDatasets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listConversationDatasetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.ConversationDataset[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.ConversationDataset) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listConversationDatasets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConversationDatasets, request)); - assert( - (client.descriptors.page.listConversationDatasets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listConversationDatasets without error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ListConversationDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationDatasetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationDataset()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationDataset()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationDataset()), - ]; - client.descriptors.page.listConversationDatasets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2.IConversationDataset[] = []; - const iterable = client.listConversationDatasetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listConversationDatasets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listConversationDatasets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listConversationDatasets with error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ListConversationDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationDatasetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listConversationDatasets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listConversationDatasetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2.IConversationDataset[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listConversationDatasets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listConversationDatasets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('conversationDataset', () => { - const fakePath = "/rendered/path/conversationDataset"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_dataset: "conversationDatasetValue", - }; - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.conversationDatasetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.conversationDatasetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('conversationDatasetPath', () => { - const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConversationDatasetName', () => { - const result = client.matchProjectFromConversationDatasetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConversationDatasetName', () => { - const result = client.matchLocationFromConversationDatasetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationDatasetFromConversationDatasetName', () => { - const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); - assert.strictEqual(result, "conversationDatasetValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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('projectConversationModel', () => { - const fakePath = "/rendered/path/projectConversationModel"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - }; - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelPath', () => { - const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelName', () => { - const result = client.matchProjectFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelName', () => { - const result = client.matchConversationModelFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelEvaluationPath', () => { - const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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('projectLocationConversationModel', () => { - const fakePath = "/rendered/path/projectLocationConversationModel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - }; - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelPath', () => { - const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelName', () => { - const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelName', () => { - const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new conversationdatasetsModule.v2.ConversationDatasetsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelEvaluationPath', () => { - const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ - 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/google-cloud-dialogflow/v2/test/gapic_conversation_models_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_conversation_models_v2.ts deleted file mode 100644 index 4f1bb56b70f..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_conversation_models_v2.ts +++ /dev/null @@ -1,3945 +0,0 @@ -// Copyright 2022 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 conversationmodelsModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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.ConversationModelsClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = conversationmodelsModule.v2.ConversationModelsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = conversationmodelsModule.v2.ConversationModelsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = conversationmodelsModule.v2.ConversationModelsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.conversationModelsStub, undefined); - await client.initialize(); - assert(client.conversationModelsStub); - }); - - it('has close method for the initialized client', done => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.conversationModelsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.conversationModelsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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('getConversationModel', () => { - it('invokes getConversationModel without error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.GetConversationModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ConversationModel() - ); - client.innerApiCalls.getConversationModel = stubSimpleCall(expectedResponse); - const [response] = await client.getConversationModel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConversationModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConversationModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConversationModel without error using callback', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.GetConversationModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ConversationModel() - ); - client.innerApiCalls.getConversationModel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getConversationModel( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversationModel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConversationModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConversationModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConversationModel with error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.GetConversationModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getConversationModel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getConversationModel(request), expectedError); - const actualRequest = (client.innerApiCalls.getConversationModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConversationModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConversationModel with closed client', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.GetConversationModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationModelRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getConversationModel(request), expectedError); - }); - }); - - describe('getConversationModelEvaluation', () => { - it('invokes getConversationModelEvaluation without error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation() - ); - client.innerApiCalls.getConversationModelEvaluation = stubSimpleCall(expectedResponse); - const [response] = await client.getConversationModelEvaluation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConversationModelEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConversationModelEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConversationModelEvaluation without error using callback', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation() - ); - client.innerApiCalls.getConversationModelEvaluation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getConversationModelEvaluation( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversationModelEvaluation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConversationModelEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConversationModelEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConversationModelEvaluation with error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getConversationModelEvaluation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getConversationModelEvaluation(request), expectedError); - const actualRequest = (client.innerApiCalls.getConversationModelEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConversationModelEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConversationModelEvaluation with closed client', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getConversationModelEvaluation(request), expectedError); - }); - }); - - describe('createConversationModel', () => { - it('invokes createConversationModel without error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.CreateConversationModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationModelRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createConversationModel = stubLongRunningCall(expectedResponse); - const [operation] = await client.createConversationModel(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createConversationModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConversationModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConversationModel without error using callback', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.CreateConversationModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationModelRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createConversationModel = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createConversationModel( - 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); - const actualRequest = (client.innerApiCalls.createConversationModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConversationModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConversationModel with call error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.CreateConversationModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationModelRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConversationModel = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createConversationModel(request), expectedError); - const actualRequest = (client.innerApiCalls.createConversationModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConversationModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConversationModel with LRO error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.CreateConversationModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationModelRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConversationModel = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createConversationModel(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createConversationModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConversationModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateConversationModelProgress without error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - 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.checkCreateConversationModelProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateConversationModelProgress with error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - 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.checkCreateConversationModelProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteConversationModel', () => { - it('invokes deleteConversationModel without error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.DeleteConversationModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteConversationModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteConversationModel = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteConversationModel(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteConversationModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConversationModel without error using callback', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.DeleteConversationModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteConversationModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteConversationModel = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteConversationModel( - 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); - const actualRequest = (client.innerApiCalls.deleteConversationModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConversationModel with call error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.DeleteConversationModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteConversationModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConversationModel = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteConversationModel(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteConversationModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConversationModel with LRO error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.DeleteConversationModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteConversationModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConversationModel = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteConversationModel(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteConversationModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteConversationModelProgress without error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - 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.checkDeleteConversationModelProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteConversationModelProgress with error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - 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.checkDeleteConversationModelProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deployConversationModel', () => { - it('invokes deployConversationModel without error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.DeployConversationModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeployConversationModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deployConversationModel = stubLongRunningCall(expectedResponse); - const [operation] = await client.deployConversationModel(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deployConversationModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deployConversationModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deployConversationModel without error using callback', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.DeployConversationModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeployConversationModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deployConversationModel = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deployConversationModel( - 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); - const actualRequest = (client.innerApiCalls.deployConversationModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deployConversationModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deployConversationModel with call error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.DeployConversationModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeployConversationModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deployConversationModel = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deployConversationModel(request), expectedError); - const actualRequest = (client.innerApiCalls.deployConversationModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deployConversationModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deployConversationModel with LRO error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.DeployConversationModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeployConversationModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deployConversationModel = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deployConversationModel(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deployConversationModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deployConversationModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeployConversationModelProgress without error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - 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.checkDeployConversationModelProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeployConversationModelProgress with error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - 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.checkDeployConversationModelProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('undeployConversationModel', () => { - it('invokes undeployConversationModel without error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.UndeployConversationModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UndeployConversationModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.undeployConversationModel = stubLongRunningCall(expectedResponse); - const [operation] = await client.undeployConversationModel(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.undeployConversationModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeployConversationModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeployConversationModel without error using callback', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.UndeployConversationModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UndeployConversationModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.undeployConversationModel = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.undeployConversationModel( - 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); - const actualRequest = (client.innerApiCalls.undeployConversationModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeployConversationModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeployConversationModel with call error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.UndeployConversationModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UndeployConversationModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.undeployConversationModel = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.undeployConversationModel(request), expectedError); - const actualRequest = (client.innerApiCalls.undeployConversationModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeployConversationModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeployConversationModel with LRO error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.UndeployConversationModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UndeployConversationModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.undeployConversationModel = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.undeployConversationModel(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.undeployConversationModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeployConversationModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUndeployConversationModelProgress without error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - 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.checkUndeployConversationModelProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUndeployConversationModelProgress with error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - 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.checkUndeployConversationModelProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createConversationModelEvaluation', () => { - it('invokes createConversationModelEvaluation without error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createConversationModelEvaluation = stubLongRunningCall(expectedResponse); - const [operation] = await client.createConversationModelEvaluation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createConversationModelEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConversationModelEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConversationModelEvaluation without error using callback', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createConversationModelEvaluation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createConversationModelEvaluation( - 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); - const actualRequest = (client.innerApiCalls.createConversationModelEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConversationModelEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConversationModelEvaluation with call error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConversationModelEvaluation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createConversationModelEvaluation(request), expectedError); - const actualRequest = (client.innerApiCalls.createConversationModelEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConversationModelEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConversationModelEvaluation with LRO error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConversationModelEvaluation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createConversationModelEvaluation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createConversationModelEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConversationModelEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateConversationModelEvaluationProgress without error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - 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.checkCreateConversationModelEvaluationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateConversationModelEvaluationProgress with error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - 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.checkCreateConversationModelEvaluationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listConversationModels', () => { - it('invokes listConversationModels without error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ListConversationModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModel()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModel()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModel()), - ]; - client.innerApiCalls.listConversationModels = stubSimpleCall(expectedResponse); - const [response] = await client.listConversationModels(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listConversationModels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConversationModels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConversationModels without error using callback', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ListConversationModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModel()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModel()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModel()), - ]; - client.innerApiCalls.listConversationModels = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listConversationModels( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversationModel[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listConversationModels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConversationModels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConversationModels with error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ListConversationModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listConversationModels = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listConversationModels(request), expectedError); - const actualRequest = (client.innerApiCalls.listConversationModels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConversationModels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConversationModelsStream without error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ListConversationModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModel()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModel()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModel()), - ]; - client.descriptors.page.listConversationModels.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listConversationModelsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.ConversationModel[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.ConversationModel) => { - 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.listConversationModels.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConversationModels, request)); - assert( - (client.descriptors.page.listConversationModels.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listConversationModelsStream with error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ListConversationModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listConversationModels.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listConversationModelsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.ConversationModel[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.ConversationModel) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listConversationModels.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConversationModels, request)); - assert( - (client.descriptors.page.listConversationModels.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listConversationModels without error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ListConversationModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModel()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModel()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModel()), - ]; - client.descriptors.page.listConversationModels.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2.IConversationModel[] = []; - const iterable = client.listConversationModelsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listConversationModels.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listConversationModels.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listConversationModels with error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ListConversationModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listConversationModels.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listConversationModelsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2.IConversationModel[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listConversationModels.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listConversationModels.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listConversationModelEvaluations', () => { - it('invokes listConversationModelEvaluations without error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation()), - ]; - client.innerApiCalls.listConversationModelEvaluations = stubSimpleCall(expectedResponse); - const [response] = await client.listConversationModelEvaluations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listConversationModelEvaluations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConversationModelEvaluations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConversationModelEvaluations without error using callback', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation()), - ]; - client.innerApiCalls.listConversationModelEvaluations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listConversationModelEvaluations( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.IConversationModelEvaluation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listConversationModelEvaluations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConversationModelEvaluations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConversationModelEvaluations with error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listConversationModelEvaluations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listConversationModelEvaluations(request), expectedError); - const actualRequest = (client.innerApiCalls.listConversationModelEvaluations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConversationModelEvaluations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConversationModelEvaluationsStream without error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation()), - ]; - client.descriptors.page.listConversationModelEvaluations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listConversationModelEvaluationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.ConversationModelEvaluation[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.ConversationModelEvaluation) => { - 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.listConversationModelEvaluations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConversationModelEvaluations, request)); - assert( - (client.descriptors.page.listConversationModelEvaluations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listConversationModelEvaluationsStream with error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listConversationModelEvaluations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listConversationModelEvaluationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.dialogflow.v2.ConversationModelEvaluation[] = []; - stream.on('data', (response: protos.google.cloud.dialogflow.v2.ConversationModelEvaluation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listConversationModelEvaluations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConversationModelEvaluations, request)); - assert( - (client.descriptors.page.listConversationModelEvaluations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listConversationModelEvaluations without error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation()), - generateSampleMessage(new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation()), - ]; - client.descriptors.page.listConversationModelEvaluations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.dialogflow.v2.IConversationModelEvaluation[] = []; - const iterable = client.listConversationModelEvaluationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listConversationModelEvaluations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listConversationModelEvaluations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listConversationModelEvaluations with error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listConversationModelEvaluations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listConversationModelEvaluationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.dialogflow.v2.IConversationModelEvaluation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listConversationModelEvaluations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listConversationModelEvaluations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('conversationDataset', () => { - const fakePath = "/rendered/path/conversationDataset"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_dataset: "conversationDatasetValue", - }; - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.conversationDatasetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.conversationDatasetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('conversationDatasetPath', () => { - const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConversationDatasetName', () => { - const result = client.matchProjectFromConversationDatasetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConversationDatasetName', () => { - const result = client.matchLocationFromConversationDatasetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationDatasetFromConversationDatasetName', () => { - const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); - assert.strictEqual(result, "conversationDatasetValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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('projectConversationModel', () => { - const fakePath = "/rendered/path/projectConversationModel"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - }; - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelPath', () => { - const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelName', () => { - const result = client.matchProjectFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelName', () => { - const result = client.matchConversationModelFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelEvaluationPath', () => { - const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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('projectLocationConversationModel', () => { - const fakePath = "/rendered/path/projectLocationConversationModel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - }; - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelPath', () => { - const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelName', () => { - const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelName', () => { - const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new conversationmodelsModule.v2.ConversationModelsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelEvaluationPath', () => { - const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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 conversationmodelsModule.v2.ConversationModelsClient({ - 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/google-cloud-dialogflow/v2/test/gapic_conversation_profiles_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_conversation_profiles_v2.ts deleted file mode 100644 index 207b6fa67d4..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_conversation_profiles_v2.ts +++ /dev/null @@ -1,3504 +0,0 @@ -// Copyright 2022 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, LROperation, operationsProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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.ConversationProfilesClient', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.conversationProfilesStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.conversationProfilesStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getConversationProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConversationProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getConversationProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConversationProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getConversationProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getConversationProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.getConversationProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConversationProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConversationProfile with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationProfileRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getConversationProfile(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createConversationProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConversationProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createConversationProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConversationProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConversationProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createConversationProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.createConversationProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConversationProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConversationProfile with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createConversationProfile(request), expectedError); - }); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateConversationProfileRequest', ['conversationProfile', 'name']); - request.conversationProfile.name = defaultValue1; - const expectedHeaderRequestParams = `conversation_profile.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateConversationProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConversationProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateConversationProfileRequest', ['conversationProfile', 'name']); - request.conversationProfile.name = defaultValue1; - const expectedHeaderRequestParams = `conversation_profile.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateConversationProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConversationProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateConversationProfileRequest', ['conversationProfile', 'name']); - request.conversationProfile.name = defaultValue1; - const expectedHeaderRequestParams = `conversation_profile.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateConversationProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateConversationProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.updateConversationProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConversationProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateConversationProfile with closed client', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateConversationProfileRequest', ['conversationProfile', 'name']); - request.conversationProfile.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateConversationProfile(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteConversationProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteConversationProfile = stubSimpleCall(expectedResponse); - const [response] = await client.deleteConversationProfile(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteConversationProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteConversationProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.deleteConversationProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteConversationProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConversationProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteConversationProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteConversationProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConversationProfile with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteConversationProfileRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteConversationProfile(request), expectedError); - }); - }); - - describe('setSuggestionFeatureConfig', () => { - it('invokes setSuggestionFeatureConfig 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.SetSuggestionFeatureConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest', ['conversationProfile']); - request.conversationProfile = defaultValue1; - const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.setSuggestionFeatureConfig = stubLongRunningCall(expectedResponse); - const [operation] = await client.setSuggestionFeatureConfig(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setSuggestionFeatureConfig 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.SetSuggestionFeatureConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest', ['conversationProfile']); - request.conversationProfile = defaultValue1; - const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.setSuggestionFeatureConfig = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setSuggestionFeatureConfig( - 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); - const actualRequest = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setSuggestionFeatureConfig with call 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.SetSuggestionFeatureConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest', ['conversationProfile']); - request.conversationProfile = defaultValue1; - const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setSuggestionFeatureConfig = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.setSuggestionFeatureConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setSuggestionFeatureConfig with LRO 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.SetSuggestionFeatureConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest', ['conversationProfile']); - request.conversationProfile = defaultValue1; - const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setSuggestionFeatureConfig = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.setSuggestionFeatureConfig(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkSetSuggestionFeatureConfigProgress without error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - 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.checkSetSuggestionFeatureConfigProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkSetSuggestionFeatureConfigProgress with error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - 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.checkSetSuggestionFeatureConfigProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('clearSuggestionFeatureConfig', () => { - it('invokes clearSuggestionFeatureConfig 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.ClearSuggestionFeatureConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest', ['conversationProfile']); - request.conversationProfile = defaultValue1; - const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.clearSuggestionFeatureConfig = stubLongRunningCall(expectedResponse); - const [operation] = await client.clearSuggestionFeatureConfig(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes clearSuggestionFeatureConfig 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.ClearSuggestionFeatureConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest', ['conversationProfile']); - request.conversationProfile = defaultValue1; - const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.clearSuggestionFeatureConfig = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.clearSuggestionFeatureConfig( - 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); - const actualRequest = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes clearSuggestionFeatureConfig with call 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.ClearSuggestionFeatureConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest', ['conversationProfile']); - request.conversationProfile = defaultValue1; - const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.clearSuggestionFeatureConfig = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.clearSuggestionFeatureConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes clearSuggestionFeatureConfig with LRO 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.ClearSuggestionFeatureConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest', ['conversationProfile']); - request.conversationProfile = defaultValue1; - const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.clearSuggestionFeatureConfig = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.clearSuggestionFeatureConfig(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkClearSuggestionFeatureConfigProgress without error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - 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.checkClearSuggestionFeatureConfigProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkClearSuggestionFeatureConfigProgress with error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - 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.checkClearSuggestionFeatureConfigProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listConversationProfiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConversationProfiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listConversationProfiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConversationProfiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listConversationProfiles = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listConversationProfiles(request), expectedError); - const actualRequest = (client.innerApiCalls.listConversationProfiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConversationProfiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listConversationProfiles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listConversationProfiles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listConversationProfiles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listConversationProfiles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('cXSecuritySettings', () => { - const fakePath = "/rendered/path/cXSecuritySettings"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_settings: "securitySettingsValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.cXSecuritySettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.cXSecuritySettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('cXSecuritySettingsPath', () => { - const result = client.cXSecuritySettingsPath("projectValue", "locationValue", "securitySettingsValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.cXSecuritySettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCXSecuritySettingsName', () => { - const result = client.matchProjectFromCXSecuritySettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.cXSecuritySettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCXSecuritySettingsName', () => { - const result = client.matchLocationFromCXSecuritySettingsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.cXSecuritySettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecuritySettingsFromCXSecuritySettingsName', () => { - const result = client.matchSecuritySettingsFromCXSecuritySettingsName(fakePath); - assert.strictEqual(result, "securitySettingsValue"); - assert((client.pathTemplates.cXSecuritySettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('conversationDataset', () => { - const fakePath = "/rendered/path/conversationDataset"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_dataset: "conversationDatasetValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.conversationDatasetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.conversationDatasetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('conversationDatasetPath', () => { - const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConversationDatasetName', () => { - const result = client.matchProjectFromConversationDatasetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConversationDatasetName', () => { - const result = client.matchLocationFromConversationDatasetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationDatasetFromConversationDatasetName', () => { - const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); - assert.strictEqual(result, "conversationDatasetValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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('projectConversationModel', () => { - const fakePath = "/rendered/path/projectConversationModel"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelPath', () => { - const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelName', () => { - const result = client.matchProjectFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelName', () => { - const result = client.matchConversationModelFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelEvaluationPath', () => { - const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { - const fakePath = "/rendered/path/projectLocationConversationModel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelPath', () => { - const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelName', () => { - const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelName', () => { - const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new conversationprofilesModule.v2.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelEvaluationPath', () => { - const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_conversations_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_conversations_v2.ts deleted file mode 100644 index df3bd430122..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_conversations_v2.ts +++ /dev/null @@ -1,3012 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.conversationsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.conversationsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createConversation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConversation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createConversation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConversation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConversation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createConversation(request), expectedError); - const actualRequest = (client.innerApiCalls.createConversation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConversation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConversation with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateConversationRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createConversation(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getConversation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConversation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getConversation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConversation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getConversation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getConversation(request), expectedError); - const actualRequest = (client.innerApiCalls.getConversation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConversation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConversation with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetConversationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getConversation(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CompleteConversationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.completeConversation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.completeConversation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CompleteConversationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.completeConversation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.completeConversation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CompleteConversationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.completeConversation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.completeConversation(request), expectedError); - const actualRequest = (client.innerApiCalls.completeConversation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.completeConversation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes completeConversation with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CompleteConversationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.completeConversation(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listConversations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConversations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listConversations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConversations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listConversations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listConversations(request), expectedError); - const actualRequest = (client.innerApiCalls.listConversations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConversations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listConversations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listConversations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listConversations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListConversationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listConversations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListMessagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listMessages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMessages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListMessagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listMessages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMessages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListMessagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMessages = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMessages(request), expectedError); - const actualRequest = (client.innerApiCalls.listMessages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMessages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListMessagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listMessages.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListMessagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listMessages.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListMessagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listMessages.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListMessagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listMessages.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('conversationDataset', () => { - const fakePath = "/rendered/path/conversationDataset"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_dataset: "conversationDatasetValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.conversationDatasetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.conversationDatasetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('conversationDatasetPath', () => { - const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConversationDatasetName', () => { - const result = client.matchProjectFromConversationDatasetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConversationDatasetName', () => { - const result = client.matchLocationFromConversationDatasetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationDatasetFromConversationDatasetName', () => { - const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); - assert.strictEqual(result, "conversationDatasetValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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('projectConversationModel', () => { - const fakePath = "/rendered/path/projectConversationModel"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelPath', () => { - const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelName', () => { - const result = client.matchProjectFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelName', () => { - const result = client.matchConversationModelFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelEvaluationPath', () => { - const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { - const fakePath = "/rendered/path/projectLocationConversationModel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelPath', () => { - const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelName', () => { - const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelName', () => { - const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new conversationsModule.v2.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelEvaluationPath', () => { - const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_documents_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_documents_v2.ts deleted file mode 100644 index 1d90f24ec19..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_documents_v2.ts +++ /dev/null @@ -1,3750 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.documentsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.documentsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDocument = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDocument(request), expectedError); - const actualRequest = (client.innerApiCalls.getDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDocument with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getDocument(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateDocumentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateDocumentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateDocumentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDocument = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createDocument(request), expectedError); - const actualRequest = (client.innerApiCalls.createDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateDocumentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDocument = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createDocument(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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('importDocuments', () => { - it('invokes importDocuments 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.ImportDocumentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ImportDocumentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.importDocuments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importDocuments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importDocuments 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.ImportDocumentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ImportDocumentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.importDocuments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importDocuments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importDocuments 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.ImportDocumentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ImportDocumentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importDocuments = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.importDocuments(request), expectedError); - const actualRequest = (client.innerApiCalls.importDocuments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importDocuments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importDocuments 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.ImportDocumentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ImportDocumentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importDocuments = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.importDocuments(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.importDocuments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importDocuments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkImportDocumentsProgress 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.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.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.checkImportDocumentsProgress(''), 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.deleteDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.deleteDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDocument = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteDocument(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDocument = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteDocument(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateDocumentRequest', ['document', 'name']); - request.document.name = defaultValue1; - const expectedHeaderRequestParams = `document.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateDocumentRequest', ['document', 'name']); - request.document.name = defaultValue1; - const expectedHeaderRequestParams = `document.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateDocumentRequest', ['document', 'name']); - request.document.name = defaultValue1; - const expectedHeaderRequestParams = `document.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDocument = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateDocument(request), expectedError); - const actualRequest = (client.innerApiCalls.updateDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateDocumentRequest', ['document', 'name']); - request.document.name = defaultValue1; - const expectedHeaderRequestParams = `document.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDocument = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateDocument(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ReloadDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.reloadDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reloadDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ReloadDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.reloadDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reloadDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ReloadDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.reloadDocument = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.reloadDocument(request), expectedError); - const actualRequest = (client.innerApiCalls.reloadDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reloadDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ReloadDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.reloadDocument = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.reloadDocument(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.reloadDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reloadDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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('exportDocument', () => { - it('invokes exportDocument 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.ExportDocumentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ExportDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportDocument = stubLongRunningCall(expectedResponse); - const [operation] = await client.exportDocument(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportDocument 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.ExportDocumentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ExportDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportDocument = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.exportDocument( - 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); - const actualRequest = (client.innerApiCalls.exportDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportDocument 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.ExportDocumentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ExportDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportDocument = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.exportDocument(request), expectedError); - const actualRequest = (client.innerApiCalls.exportDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportDocument 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.ExportDocumentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ExportDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportDocument = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.exportDocument(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.exportDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkExportDocumentProgress 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.checkExportDocumentProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkExportDocumentProgress 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.checkExportDocumentProgress(''), 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListDocumentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listDocuments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDocuments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListDocumentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listDocuments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDocuments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListDocumentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDocuments = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDocuments(request), expectedError); - const actualRequest = (client.innerApiCalls.listDocuments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDocuments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListDocumentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listDocuments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListDocumentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listDocuments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListDocumentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listDocuments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListDocumentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listDocuments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('conversationDataset', () => { - const fakePath = "/rendered/path/conversationDataset"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_dataset: "conversationDatasetValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.conversationDatasetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.conversationDatasetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('conversationDatasetPath', () => { - const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConversationDatasetName', () => { - const result = client.matchProjectFromConversationDatasetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConversationDatasetName', () => { - const result = client.matchLocationFromConversationDatasetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationDatasetFromConversationDatasetName', () => { - const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); - assert.strictEqual(result, "conversationDatasetValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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('projectConversationModel', () => { - const fakePath = "/rendered/path/projectConversationModel"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelPath', () => { - const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelName', () => { - const result = client.matchProjectFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelName', () => { - const result = client.matchConversationModelFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelEvaluationPath', () => { - const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { - const fakePath = "/rendered/path/projectLocationConversationModel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelPath', () => { - const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelName', () => { - const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelName', () => { - const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new documentsModule.v2.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelEvaluationPath', () => { - const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_entity_types_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_entity_types_v2.ts deleted file mode 100644 index 7b2fede66a3..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_entity_types_v2.ts +++ /dev/null @@ -1,3920 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.entityTypesStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.entityTypesStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getEntityType(request), expectedError); - const actualRequest = (client.innerApiCalls.getEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getEntityType with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getEntityType(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateEntityTypeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateEntityTypeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateEntityTypeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createEntityType(request), expectedError); - const actualRequest = (client.innerApiCalls.createEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createEntityType with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateEntityTypeRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createEntityType(request), expectedError); - }); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateEntityTypeRequest', ['entityType', 'name']); - request.entityType.name = defaultValue1; - const expectedHeaderRequestParams = `entity_type.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateEntityTypeRequest', ['entityType', 'name']); - request.entityType.name = defaultValue1; - const expectedHeaderRequestParams = `entity_type.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateEntityTypeRequest', ['entityType', 'name']); - request.entityType.name = defaultValue1; - const expectedHeaderRequestParams = `entity_type.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateEntityType(request), expectedError); - const actualRequest = (client.innerApiCalls.updateEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateEntityType with closed client', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateEntityTypeRequest', ['entityType', 'name']); - request.entityType.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateEntityType(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteEntityType = stubSimpleCall(expectedResponse); - const [response] = await client.deleteEntityType(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.deleteEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteEntityType(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteEntityType with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteEntityType(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchUpdateEntityTypes(request), expectedError); - const actualRequest = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchUpdateEntityTypes(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchDeleteEntityTypes(request), expectedError); - const actualRequest = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchDeleteEntityTypes(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchCreateEntities as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateEntities as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchCreateEntities as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateEntities as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchCreateEntities = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchCreateEntities(request), expectedError); - const actualRequest = (client.innerApiCalls.batchCreateEntities as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateEntities as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchCreateEntities = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchCreateEntities(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.batchCreateEntities as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateEntities as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchUpdateEntities as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntities as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchUpdateEntities as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntities as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateEntities = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchUpdateEntities(request), expectedError); - const actualRequest = (client.innerApiCalls.batchUpdateEntities as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntities as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateEntities = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchUpdateEntities(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.batchUpdateEntities as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntities as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchDeleteEntities as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntities as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchDeleteEntities as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntities as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteEntities = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchDeleteEntities(request), expectedError); - const actualRequest = (client.innerApiCalls.batchDeleteEntities as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntities as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteEntities = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchDeleteEntities(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.batchDeleteEntities as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntities as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listEntityTypes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listEntityTypes(request), expectedError); - const actualRequest = (client.innerApiCalls.listEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listEntityTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listEntityTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('conversationDataset', () => { - const fakePath = "/rendered/path/conversationDataset"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_dataset: "conversationDatasetValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.conversationDatasetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.conversationDatasetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('conversationDatasetPath', () => { - const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConversationDatasetName', () => { - const result = client.matchProjectFromConversationDatasetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConversationDatasetName', () => { - const result = client.matchLocationFromConversationDatasetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationDatasetFromConversationDatasetName', () => { - const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); - assert.strictEqual(result, "conversationDatasetValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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('projectConversationModel', () => { - const fakePath = "/rendered/path/projectConversationModel"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelPath', () => { - const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelName', () => { - const result = client.matchProjectFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelName', () => { - const result = client.matchConversationModelFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelEvaluationPath', () => { - const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { - const fakePath = "/rendered/path/projectLocationConversationModel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelPath', () => { - const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelName', () => { - const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelName', () => { - const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new entitytypesModule.v2.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelEvaluationPath', () => { - const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_environments_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_environments_v2.ts deleted file mode 100644 index 6708ef9f5b8..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_environments_v2.ts +++ /dev/null @@ -1,3124 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.environmentsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.environmentsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEnvironmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getEnvironment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEnvironment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEnvironmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getEnvironment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEnvironment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEnvironmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getEnvironment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getEnvironment(request), expectedError); - const actualRequest = (client.innerApiCalls.getEnvironment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEnvironment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getEnvironment with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEnvironmentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getEnvironment(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateEnvironmentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createEnvironment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEnvironment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateEnvironmentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createEnvironment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEnvironment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateEnvironmentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createEnvironment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createEnvironment(request), expectedError); - const actualRequest = (client.innerApiCalls.createEnvironment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEnvironment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createEnvironment with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateEnvironmentRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createEnvironment(request), expectedError); - }); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateEnvironmentRequest', ['environment', 'name']); - request.environment.name = defaultValue1; - const expectedHeaderRequestParams = `environment.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateEnvironment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEnvironment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateEnvironmentRequest', ['environment', 'name']); - request.environment.name = defaultValue1; - const expectedHeaderRequestParams = `environment.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateEnvironment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEnvironment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateEnvironmentRequest', ['environment', 'name']); - request.environment.name = defaultValue1; - const expectedHeaderRequestParams = `environment.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateEnvironment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateEnvironment(request), expectedError); - const actualRequest = (client.innerApiCalls.updateEnvironment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEnvironment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateEnvironment with closed client', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateEnvironmentRequest', ['environment', 'name']); - request.environment.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateEnvironment(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteEnvironmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteEnvironment = stubSimpleCall(expectedResponse); - const [response] = await client.deleteEnvironment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteEnvironment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteEnvironment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteEnvironmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.deleteEnvironment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteEnvironment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteEnvironmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteEnvironment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteEnvironment(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteEnvironment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteEnvironment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteEnvironment with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteEnvironmentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteEnvironment(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEnvironmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listEnvironments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEnvironments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEnvironmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listEnvironments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEnvironments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEnvironmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listEnvironments = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listEnvironments(request), expectedError); - const actualRequest = (client.innerApiCalls.listEnvironments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEnvironments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEnvironmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listEnvironments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEnvironmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listEnvironments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEnvironmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListEnvironmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.getEnvironmentHistory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEnvironmentHistory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.getEnvironmentHistory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEnvironmentHistory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getEnvironmentHistory = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getEnvironmentHistory(request), expectedError); - const actualRequest = (client.innerApiCalls.getEnvironmentHistory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEnvironmentHistory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.getEnvironmentHistory.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.getEnvironmentHistory.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.getEnvironmentHistory.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.getEnvironmentHistory.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('conversationDataset', () => { - const fakePath = "/rendered/path/conversationDataset"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_dataset: "conversationDatasetValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.conversationDatasetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.conversationDatasetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('conversationDatasetPath', () => { - const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConversationDatasetName', () => { - const result = client.matchProjectFromConversationDatasetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConversationDatasetName', () => { - const result = client.matchLocationFromConversationDatasetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationDatasetFromConversationDatasetName', () => { - const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); - assert.strictEqual(result, "conversationDatasetValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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('projectConversationModel', () => { - const fakePath = "/rendered/path/projectConversationModel"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelPath', () => { - const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelName', () => { - const result = client.matchProjectFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelName', () => { - const result = client.matchConversationModelFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelEvaluationPath', () => { - const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { - const fakePath = "/rendered/path/projectLocationConversationModel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelPath', () => { - const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelName', () => { - const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelName', () => { - const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new environmentsModule.v2.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelEvaluationPath', () => { - const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_fulfillments_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_fulfillments_v2.ts deleted file mode 100644 index a1f8f9221b4..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_fulfillments_v2.ts +++ /dev/null @@ -1,2361 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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 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.FulfillmentsClient', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.fulfillmentsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.fulfillmentsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetFulfillmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getFulfillment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFulfillment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetFulfillmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getFulfillment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFulfillment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetFulfillmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFulfillment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFulfillment(request), expectedError); - const actualRequest = (client.innerApiCalls.getFulfillment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFulfillment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFulfillment with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetFulfillmentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFulfillment(request), expectedError); - }); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateFulfillmentRequest', ['fulfillment', 'name']); - request.fulfillment.name = defaultValue1; - const expectedHeaderRequestParams = `fulfillment.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateFulfillment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFulfillment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateFulfillmentRequest', ['fulfillment', 'name']); - request.fulfillment.name = defaultValue1; - const expectedHeaderRequestParams = `fulfillment.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateFulfillment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFulfillment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateFulfillmentRequest', ['fulfillment', 'name']); - request.fulfillment.name = defaultValue1; - const expectedHeaderRequestParams = `fulfillment.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFulfillment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateFulfillment(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFulfillment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFulfillment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFulfillment with closed client', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateFulfillmentRequest', ['fulfillment', 'name']); - request.fulfillment.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateFulfillment(request), expectedError); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('conversationDataset', () => { - const fakePath = "/rendered/path/conversationDataset"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_dataset: "conversationDatasetValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.conversationDatasetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.conversationDatasetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('conversationDatasetPath', () => { - const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConversationDatasetName', () => { - const result = client.matchProjectFromConversationDatasetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConversationDatasetName', () => { - const result = client.matchLocationFromConversationDatasetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationDatasetFromConversationDatasetName', () => { - const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); - assert.strictEqual(result, "conversationDatasetValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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('projectConversationModel', () => { - const fakePath = "/rendered/path/projectConversationModel"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelPath', () => { - const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelName', () => { - const result = client.matchProjectFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelName', () => { - const result = client.matchConversationModelFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelEvaluationPath', () => { - const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { - const fakePath = "/rendered/path/projectLocationConversationModel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelPath', () => { - const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelName', () => { - const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelName', () => { - const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new fulfillmentsModule.v2.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelEvaluationPath', () => { - const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_intents_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_intents_v2.ts deleted file mode 100644 index 4d062a1b1fc..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_intents_v2.ts +++ /dev/null @@ -1,3458 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.intentsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.intentsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetIntentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetIntentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetIntentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getIntent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIntent(request), expectedError); - const actualRequest = (client.innerApiCalls.getIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIntent with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetIntentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getIntent(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateIntentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateIntentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateIntentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createIntent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createIntent(request), expectedError); - const actualRequest = (client.innerApiCalls.createIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createIntent with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateIntentRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createIntent(request), expectedError); - }); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateIntentRequest', ['intent', 'name']); - request.intent.name = defaultValue1; - const expectedHeaderRequestParams = `intent.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateIntentRequest', ['intent', 'name']); - request.intent.name = defaultValue1; - const expectedHeaderRequestParams = `intent.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateIntentRequest', ['intent', 'name']); - request.intent.name = defaultValue1; - const expectedHeaderRequestParams = `intent.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateIntent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateIntent(request), expectedError); - const actualRequest = (client.innerApiCalls.updateIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateIntent with closed client', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateIntentRequest', ['intent', 'name']); - request.intent.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateIntent(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteIntentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteIntent = stubSimpleCall(expectedResponse); - const [response] = await client.deleteIntent(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteIntentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.deleteIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteIntentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteIntent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteIntent(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteIntent with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteIntentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteIntent(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchUpdateIntents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateIntents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchUpdateIntents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateIntents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateIntents = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchUpdateIntents(request), expectedError); - const actualRequest = (client.innerApiCalls.batchUpdateIntents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateIntents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateIntents = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchUpdateIntents(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.batchUpdateIntents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateIntents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchDeleteIntents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteIntents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchDeleteIntents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteIntents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteIntents = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchDeleteIntents(request), expectedError); - const actualRequest = (client.innerApiCalls.batchDeleteIntents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteIntents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteIntents = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchDeleteIntents(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.batchDeleteIntents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteIntents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listIntents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listIntents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listIntents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listIntents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listIntents = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listIntents(request), expectedError); - const actualRequest = (client.innerApiCalls.listIntents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listIntents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listIntents.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listIntents.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listIntents.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listIntents.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('conversationDataset', () => { - const fakePath = "/rendered/path/conversationDataset"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_dataset: "conversationDatasetValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.conversationDatasetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.conversationDatasetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('conversationDatasetPath', () => { - const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConversationDatasetName', () => { - const result = client.matchProjectFromConversationDatasetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConversationDatasetName', () => { - const result = client.matchLocationFromConversationDatasetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationDatasetFromConversationDatasetName', () => { - const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); - assert.strictEqual(result, "conversationDatasetValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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('projectConversationModel', () => { - const fakePath = "/rendered/path/projectConversationModel"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelPath', () => { - const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelName', () => { - const result = client.matchProjectFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelName', () => { - const result = client.matchConversationModelFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelEvaluationPath', () => { - const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { - const fakePath = "/rendered/path/projectLocationConversationModel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelPath', () => { - const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelName', () => { - const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelName', () => { - const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new intentsModule.v2.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelEvaluationPath', () => { - const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_knowledge_bases_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_knowledge_bases_v2.ts deleted file mode 100644 index 2cc801d5cd2..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_knowledge_bases_v2.ts +++ /dev/null @@ -1,2879 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.knowledgeBasesStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.knowledgeBasesStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getKnowledgeBase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getKnowledgeBase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getKnowledgeBase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getKnowledgeBase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getKnowledgeBase = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getKnowledgeBase(request), expectedError); - const actualRequest = (client.innerApiCalls.getKnowledgeBase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getKnowledgeBase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getKnowledgeBase with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getKnowledgeBase(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createKnowledgeBase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createKnowledgeBase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createKnowledgeBase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createKnowledgeBase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createKnowledgeBase = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createKnowledgeBase(request), expectedError); - const actualRequest = (client.innerApiCalls.createKnowledgeBase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createKnowledgeBase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createKnowledgeBase with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createKnowledgeBase(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteKnowledgeBase = stubSimpleCall(expectedResponse); - const [response] = await client.deleteKnowledgeBase(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteKnowledgeBase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteKnowledgeBase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.deleteKnowledgeBase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteKnowledgeBase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteKnowledgeBase = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteKnowledgeBase(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteKnowledgeBase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteKnowledgeBase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteKnowledgeBase with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteKnowledgeBase(request), expectedError); - }); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest', ['knowledgeBase', 'name']); - request.knowledgeBase.name = defaultValue1; - const expectedHeaderRequestParams = `knowledge_base.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateKnowledgeBase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateKnowledgeBase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest', ['knowledgeBase', 'name']); - request.knowledgeBase.name = defaultValue1; - const expectedHeaderRequestParams = `knowledge_base.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateKnowledgeBase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateKnowledgeBase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest', ['knowledgeBase', 'name']); - request.knowledgeBase.name = defaultValue1; - const expectedHeaderRequestParams = `knowledge_base.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateKnowledgeBase = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateKnowledgeBase(request), expectedError); - const actualRequest = (client.innerApiCalls.updateKnowledgeBase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateKnowledgeBase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateKnowledgeBase with closed client', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest', ['knowledgeBase', 'name']); - request.knowledgeBase.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateKnowledgeBase(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listKnowledgeBases as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listKnowledgeBases as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listKnowledgeBases as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listKnowledgeBases as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listKnowledgeBases = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listKnowledgeBases(request), expectedError); - const actualRequest = (client.innerApiCalls.listKnowledgeBases as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listKnowledgeBases as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listKnowledgeBases.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listKnowledgeBases.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('conversationDataset', () => { - const fakePath = "/rendered/path/conversationDataset"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_dataset: "conversationDatasetValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.conversationDatasetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.conversationDatasetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('conversationDatasetPath', () => { - const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConversationDatasetName', () => { - const result = client.matchProjectFromConversationDatasetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConversationDatasetName', () => { - const result = client.matchLocationFromConversationDatasetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationDatasetFromConversationDatasetName', () => { - const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); - assert.strictEqual(result, "conversationDatasetValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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('projectConversationModel', () => { - const fakePath = "/rendered/path/projectConversationModel"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelPath', () => { - const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelName', () => { - const result = client.matchProjectFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelName', () => { - const result = client.matchConversationModelFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelEvaluationPath', () => { - const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { - const fakePath = "/rendered/path/projectLocationConversationModel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelPath', () => { - const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelName', () => { - const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelName', () => { - const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelEvaluationPath', () => { - const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_participants_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_participants_v2.ts deleted file mode 100644 index c5272f6f17b..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_participants_v2.ts +++ /dev/null @@ -1,3276 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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); -} - -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', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.participantsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.participantsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateParticipantRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createParticipant as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createParticipant as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateParticipantRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createParticipant as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createParticipant as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateParticipantRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createParticipant = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createParticipant(request), expectedError); - const actualRequest = (client.innerApiCalls.createParticipant as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createParticipant as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createParticipant with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateParticipantRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createParticipant(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetParticipantRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getParticipant as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getParticipant as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetParticipantRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getParticipant as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getParticipant as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetParticipantRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getParticipant = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getParticipant(request), expectedError); - const actualRequest = (client.innerApiCalls.getParticipant as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getParticipant as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getParticipant with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetParticipantRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getParticipant(request), expectedError); - }); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateParticipantRequest', ['participant', 'name']); - request.participant.name = defaultValue1; - const expectedHeaderRequestParams = `participant.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateParticipant as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateParticipant as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateParticipantRequest', ['participant', 'name']); - request.participant.name = defaultValue1; - const expectedHeaderRequestParams = `participant.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateParticipant as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateParticipant as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateParticipantRequest', ['participant', 'name']); - request.participant.name = defaultValue1; - const expectedHeaderRequestParams = `participant.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateParticipant = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateParticipant(request), expectedError); - const actualRequest = (client.innerApiCalls.updateParticipant as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateParticipant as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateParticipant with closed client', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateParticipantRequest', ['participant', 'name']); - request.participant.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateParticipant(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.AnalyzeContentRequest', ['participant']); - request.participant = defaultValue1; - const expectedHeaderRequestParams = `participant=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.analyzeContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.analyzeContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.AnalyzeContentRequest', ['participant']); - request.participant = defaultValue1; - const expectedHeaderRequestParams = `participant=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.analyzeContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.analyzeContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.AnalyzeContentRequest', ['participant']); - request.participant = defaultValue1; - const expectedHeaderRequestParams = `participant=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.analyzeContent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.analyzeContent(request), expectedError); - const actualRequest = (client.innerApiCalls.analyzeContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.analyzeContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes analyzeContent with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.AnalyzeContentRequest', ['participant']); - request.participant = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.analyzeContent(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SuggestArticlesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.suggestArticles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.suggestArticles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SuggestArticlesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.suggestArticles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.suggestArticles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SuggestArticlesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.suggestArticles = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.suggestArticles(request), expectedError); - const actualRequest = (client.innerApiCalls.suggestArticles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.suggestArticles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes suggestArticles with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SuggestArticlesRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.suggestArticles(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.suggestFaqAnswers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.suggestFaqAnswers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.suggestFaqAnswers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.suggestFaqAnswers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.suggestFaqAnswers = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.suggestFaqAnswers(request), expectedError); - const actualRequest = (client.innerApiCalls.suggestFaqAnswers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.suggestFaqAnswers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes suggestFaqAnswers with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.suggestFaqAnswers(request), expectedError); - }); - }); - - describe('suggestSmartReplies', () => { - it('invokes suggestSmartReplies 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.SuggestSmartRepliesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.SuggestSmartRepliesResponse() - ); - client.innerApiCalls.suggestSmartReplies = stubSimpleCall(expectedResponse); - const [response] = await client.suggestSmartReplies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.suggestSmartReplies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.suggestSmartReplies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes suggestSmartReplies 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.SuggestSmartRepliesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.SuggestSmartRepliesResponse() - ); - client.innerApiCalls.suggestSmartReplies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.suggestSmartReplies( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.suggestSmartReplies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.suggestSmartReplies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes suggestSmartReplies 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.SuggestSmartRepliesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.suggestSmartReplies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.suggestSmartReplies(request), expectedError); - const actualRequest = (client.innerApiCalls.suggestSmartReplies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.suggestSmartReplies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes suggestSmartReplies with closed client', 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.SuggestSmartRepliesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.suggestSmartReplies(request), expectedError); - }); - }); - - describe('streamingAnalyzeContent', () => { - it('invokes streamingAnalyzeContent 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.StreamingAnalyzeContentRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse() - ); - client.innerApiCalls.streamingAnalyzeContent = stubBidiStreamingCall(expectedResponse); - const stream = client.streamingAnalyzeContent(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse) => { - 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.streamingAnalyzeContent as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes streamingAnalyzeContent 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.StreamingAnalyzeContentRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.streamingAnalyzeContent = stubBidiStreamingCall(undefined, expectedError); - const stream = client.streamingAnalyzeContent(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.streamingAnalyzeContent as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListParticipantsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listParticipants as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listParticipants as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListParticipantsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listParticipants as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listParticipants as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListParticipantsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listParticipants = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listParticipants(request), expectedError); - const actualRequest = (client.innerApiCalls.listParticipants as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listParticipants as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListParticipantsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listParticipants.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListParticipantsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listParticipants.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListParticipantsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listParticipants.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListParticipantsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listParticipants.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('conversationDataset', () => { - const fakePath = "/rendered/path/conversationDataset"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_dataset: "conversationDatasetValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.conversationDatasetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.conversationDatasetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('conversationDatasetPath', () => { - const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConversationDatasetName', () => { - const result = client.matchProjectFromConversationDatasetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConversationDatasetName', () => { - const result = client.matchLocationFromConversationDatasetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationDatasetFromConversationDatasetName', () => { - const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); - assert.strictEqual(result, "conversationDatasetValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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('projectConversationModel', () => { - const fakePath = "/rendered/path/projectConversationModel"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelPath', () => { - const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelName', () => { - const result = client.matchProjectFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelName', () => { - const result = client.matchConversationModelFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelEvaluationPath', () => { - const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { - const fakePath = "/rendered/path/projectLocationConversationModel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelPath', () => { - const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelName', () => { - const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelName', () => { - const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new participantsModule.v2.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelEvaluationPath', () => { - const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_session_entity_types_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_session_entity_types_v2.ts deleted file mode 100644 index ca30f3938fc..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_session_entity_types_v2.ts +++ /dev/null @@ -1,2917 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.sessionEntityTypesStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sessionEntityTypesStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getSessionEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSessionEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getSessionEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSessionEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSessionEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSessionEntityType(request), expectedError); - const actualRequest = (client.innerApiCalls.getSessionEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSessionEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSessionEntityType with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSessionEntityType(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createSessionEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSessionEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createSessionEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSessionEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSessionEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSessionEntityType(request), expectedError); - const actualRequest = (client.innerApiCalls.createSessionEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSessionEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSessionEntityType with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createSessionEntityType(request), expectedError); - }); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest', ['sessionEntityType', 'name']); - request.sessionEntityType.name = defaultValue1; - const expectedHeaderRequestParams = `session_entity_type.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateSessionEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSessionEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest', ['sessionEntityType', 'name']); - request.sessionEntityType.name = defaultValue1; - const expectedHeaderRequestParams = `session_entity_type.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateSessionEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSessionEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest', ['sessionEntityType', 'name']); - request.sessionEntityType.name = defaultValue1; - const expectedHeaderRequestParams = `session_entity_type.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSessionEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSessionEntityType(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSessionEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSessionEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSessionEntityType with closed client', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest', ['sessionEntityType', 'name']); - request.sessionEntityType.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateSessionEntityType(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSessionEntityType = stubSimpleCall(expectedResponse); - const [response] = await client.deleteSessionEntityType(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSessionEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSessionEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.deleteSessionEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSessionEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSessionEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteSessionEntityType(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSessionEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSessionEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSessionEntityType with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteSessionEntityType(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listSessionEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSessionEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listSessionEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSessionEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSessionEntityTypes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSessionEntityTypes(request), expectedError); - const actualRequest = (client.innerApiCalls.listSessionEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSessionEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listSessionEntityTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listSessionEntityTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listSessionEntityTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listSessionEntityTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('conversationDataset', () => { - const fakePath = "/rendered/path/conversationDataset"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_dataset: "conversationDatasetValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.conversationDatasetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.conversationDatasetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('conversationDatasetPath', () => { - const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConversationDatasetName', () => { - const result = client.matchProjectFromConversationDatasetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConversationDatasetName', () => { - const result = client.matchLocationFromConversationDatasetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationDatasetFromConversationDatasetName', () => { - const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); - assert.strictEqual(result, "conversationDatasetValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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('projectConversationModel', () => { - const fakePath = "/rendered/path/projectConversationModel"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelPath', () => { - const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelName', () => { - const result = client.matchProjectFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelName', () => { - const result = client.matchConversationModelFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelEvaluationPath', () => { - const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { - const fakePath = "/rendered/path/projectLocationConversationModel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelPath', () => { - const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelName', () => { - const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelName', () => { - const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelEvaluationPath', () => { - const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_sessions_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_sessions_v2.ts deleted file mode 100644 index b1148126e37..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_sessions_v2.ts +++ /dev/null @@ -1,2524 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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); -} - -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.SessionsClient', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.sessionsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sessionsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DetectIntentRequest', ['session']); - request.session = defaultValue1; - const expectedHeaderRequestParams = `session=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.detectIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.detectIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DetectIntentRequest', ['session']); - request.session = defaultValue1; - const expectedHeaderRequestParams = `session=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.detectIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.detectIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DetectIntentRequest', ['session']); - request.session = defaultValue1; - const expectedHeaderRequestParams = `session=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.detectIntent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.detectIntent(request), expectedError); - const actualRequest = (client.innerApiCalls.detectIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.detectIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes detectIntent with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DetectIntentRequest', ['session']); - request.session = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.detectIntent(request), expectedError); - }); - }); - - 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).calledWith(null)); - 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).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('conversationDataset', () => { - const fakePath = "/rendered/path/conversationDataset"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_dataset: "conversationDatasetValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.conversationDatasetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.conversationDatasetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('conversationDatasetPath', () => { - const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConversationDatasetName', () => { - const result = client.matchProjectFromConversationDatasetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConversationDatasetName', () => { - const result = client.matchLocationFromConversationDatasetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationDatasetFromConversationDatasetName', () => { - const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); - assert.strictEqual(result, "conversationDatasetValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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('projectConversationModel', () => { - const fakePath = "/rendered/path/projectConversationModel"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelPath', () => { - const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelName', () => { - const result = client.matchProjectFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelName', () => { - const result = client.matchConversationModelFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelEvaluationPath', () => { - const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { - const fakePath = "/rendered/path/projectLocationConversationModel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelPath', () => { - const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelName', () => { - const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelName', () => { - const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new sessionsModule.v2.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelEvaluationPath', () => { - const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/test/gapic_versions_v2.ts b/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_versions_v2.ts deleted file mode 100644 index c1d56d37b98..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2/test/gapic_versions_v2.ts +++ /dev/null @@ -1,2879 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.versionsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.versionsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.getVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVersion with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.GetVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getVersion(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.createVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createVersion with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.CreateVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createVersion(request), expectedError); - }); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateVersionRequest', ['version', 'name']); - request.version.name = defaultValue1; - const expectedHeaderRequestParams = `version.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateVersionRequest', ['version', 'name']); - request.version.name = defaultValue1; - const expectedHeaderRequestParams = `version.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateVersionRequest', ['version', 'name']); - request.version.name = defaultValue1; - const expectedHeaderRequestParams = `version.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.updateVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateVersion with closed client', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.UpdateVersionRequest', ['version', 'name']); - request.version.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateVersion(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteVersion = stubSimpleCall(expectedResponse); - const [response] = await client.deleteVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteVersion with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.DeleteVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteVersion(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listVersions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listVersions(request), expectedError); - const actualRequest = (client.innerApiCalls.listVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('conversationDataset', () => { - const fakePath = "/rendered/path/conversationDataset"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_dataset: "conversationDatasetValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.conversationDatasetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.conversationDatasetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('conversationDatasetPath', () => { - const result = client.conversationDatasetPath("projectValue", "locationValue", "conversationDatasetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.conversationDatasetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConversationDatasetName', () => { - const result = client.matchProjectFromConversationDatasetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConversationDatasetName', () => { - const result = client.matchLocationFromConversationDatasetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationDatasetFromConversationDatasetName', () => { - const result = client.matchConversationDatasetFromConversationDatasetName(fakePath); - assert.strictEqual(result, "conversationDatasetValue"); - assert((client.pathTemplates.conversationDatasetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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('projectConversationModel', () => { - const fakePath = "/rendered/path/projectConversationModel"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelPath', () => { - const result = client.projectConversationModelPath("projectValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelName', () => { - const result = client.matchProjectFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelName', () => { - const result = client.matchConversationModelFromProjectConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectConversationModelEvaluationPath', () => { - const result = client.projectConversationModelEvaluationPath("projectValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectConversationModelEvaluationPathTemplate.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('projectLocationConversationModel', () => { - const fakePath = "/rendered/path/projectLocationConversationModel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelPath', () => { - const result = client.projectLocationConversationModelPath("projectValue", "locationValue", "conversationModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelName', () => { - const result = client.matchProjectFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelName', () => { - const result = client.matchLocationFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationConversationModelEvaluation', () => { - const fakePath = "/rendered/path/projectLocationConversationModelEvaluation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation_model: "conversationModelValue", - evaluation: "evaluationValue", - }; - const client = new versionsModule.v2.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationConversationModelEvaluationPath', () => { - const result = client.projectLocationConversationModelEvaluationPath("projectValue", "locationValue", "conversationModelValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchProjectFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchLocationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchConversationModelFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "conversationModelValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { - const result = client.matchEvaluationFromProjectLocationConversationModelEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.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/google-cloud-dialogflow/v2/tsconfig.json b/owl-bot-staging/google-cloud-dialogflow/v2/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2/webpack.config.js b/owl-bot-staging/google-cloud-dialogflow/v2/webpack.config.js deleted file mode 100644 index 0d2fc635111..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/.eslintignore b/owl-bot-staging/google-cloud-dialogflow/v2beta1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/.eslintrc.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/.gitignore b/owl-bot-staging/google-cloud-dialogflow/v2beta1/.gitignore deleted file mode 100644 index 5d32b23782f..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/.jsdoc.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/.jsdoc.js deleted file mode 100644 index fe4bcaa346d..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 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 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/dialogflow', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/.mocharc.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/.mocharc.js deleted file mode 100644 index 481c522b00f..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 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/google-cloud-dialogflow/v2beta1/.prettierrc.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/.prettierrc.js deleted file mode 100644 index 494e147865d..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2022 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/google-cloud-dialogflow/v2beta1/README.md b/owl-bot-staging/google-cloud-dialogflow/v2beta1/README.md deleted file mode 100644 index f592662ac92..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Dialogflow: Nodejs Client diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/linkinator.config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/linkinator.config.json deleted file mode 100644 index befd23c8633..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/package.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/package.json deleted file mode 100644 index e4beee27674..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/ && minifyProtoJson", - "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": "^3.5.2" - }, - "devDependencies": { - "@types/mocha": "^9.1.1", - "@types/node": "^16.11.62", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^3.6.11", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.0.3", - "mocha": "^10.0.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^14.0.0", - "ts-loader": "^8.4.0", - "typescript": "^4.8.3", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/agent.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/agent.proto deleted file mode 100644 index 95b3933a6d4..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/agent.proto +++ /dev/null @@ -1,578 +0,0 @@ -// Copyright 2022 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/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. - // - // 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: "/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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: An empty [Struct - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - // - `response`: An [Empty - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - // - // 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: "/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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: An empty [Struct - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - // - `response`: [ExportAgentResponse][google.cloud.dialogflow.v2beta1.ExportAgentResponse] - 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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: An empty [Struct - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - // - `response`: An [Empty - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - // - // The operation only tracks when importing is complete, 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: "/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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: An empty [Struct - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - // - `response`: An [Empty - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - // - // The operation only tracks when restoring is complete, 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: "/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; - - // Trial Edition, previously known as Standard Edition. - TIER_STANDARD = 1; - - // Essentials Edition, previously known as Enterprise Essential Edition. - TIER_ENTERPRISE = 2; - - // Essentials Edition (same as TIER_ENTERPRISE), previously known as - // Enterprise Plus Edition. - TIER_ENTERPRISE_PLUS = 3 [deprecated = true]; - } - - // 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. - // - // Dialogflow performs a write operation for the Cloud Storage object - // on the caller's behalf, so your request authentication must - // have write permissions for the object. For more information, see - // [Dialogflow access - // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). - 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://". - // - // Dialogflow performs a read operation for the Cloud Storage object - // on the caller's behalf, so your request authentication must - // have read permissions for the object. For more information, see - // [Dialogflow access - // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). - 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://". - // - // Dialogflow performs a read operation for the Cloud Storage object - // on the caller's behalf, so your request authentication must - // have read permissions for the object. For more information, see - // [Dialogflow access - // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). - 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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/answer_record.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/answer_record.proto deleted file mode 100644 index 1193f90c617..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/answer_record.proto +++ /dev/null @@ -1,325 +0,0 @@ -// Copyright 2022 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/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 { - // 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; - } - - // 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; - } - - // 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. Filters to restrict results to specific answer records. - // - // For more information about filtering, see - // [API Filtering](https://aip.dev/160). - string filter = 2 [ - deprecated = true, - (google.api.field_behavior) = OPTIONAL - ]; - - // 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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/audio_config.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/audio_config.proto deleted file mode 100644 index b9e83b20bef..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/audio_config.proto +++ /dev/null @@ -1,462 +0,0 @@ -// Copyright 2022 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"; - -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"; -option (google.api.resource_definition) = { - type: "automl.googleapis.com/Model" - pattern: "projects/{project}/locations/{location}/models/{model}" -}; - -// 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; -} - -// 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; -} - -// 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; -} - -// 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; -} - -// 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; -} - -// 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; -} - -// 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; -} - -// 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; -} - -// [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; -} - -// A wrapper of repeated TelephonyDtmf digits. -message TelephonyDtmfEvents { - // A sequence of TelephonyDtmf digits. - repeated TelephonyDtmf dtmf_events = 1; -} - -// Configures speech transcription for -// [ConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfile]. -message SpeechToTextConfig { - // 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. If enhanced model variant is specified and an enhanced version of - // the specified model for the language does not exist, then it would emit an - // error. - SpeechModelVariant speech_model_variant = 1; - - // Which Speech model to select. Select the model best suited to your domain - // to get best results. If a model is not explicitly specified, then a default - // model is used. - // Refer to - // [Cloud Speech API - // documentation](https://cloud.google.com/speech-to-text/docs/basics#select-model) - // for more details. - string model = 2; -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/context.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/context.proto deleted file mode 100644 index a8e8c21f91f..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/context.proto +++ /dev/null @@ -1,375 +0,0 @@ -// Copyright 2022 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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation.proto deleted file mode 100644 index 432d8c08024..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation.proto +++ /dev/null @@ -1,494 +0,0 @@ -// Copyright 2022 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/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 = "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"; - } - - // Suggest summary for a conversation based on specific historical messages. - // The range of the messages to be used for summary can be specified in the - // request. - rpc SuggestConversationSummary(SuggestConversationSummaryRequest) returns (SuggestConversationSummaryResponse) { - option (google.api.http) = { - post: "/v2beta1/{conversation=projects/*/conversations/*}/suggestions:suggestConversationSummary" - body: "*" - additional_bindings { - post: "/v2beta1/{conversation=projects/*/locations/*/conversations/*}/suggestions:suggestConversationSummary" - body: "*" - } - }; - option (google.api.method_signature) = "conversation"; - } -} - -// 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; -} - -// The request message for [Conversations.SuggestConversationSummary][google.cloud.dialogflow.v2beta1.Conversations.SuggestConversationSummary]. -message SuggestConversationSummaryRequest { - // Required. The conversation to fetch suggestion for. - // Format: `projects//locations//conversations/`. - string conversation = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Conversation" - } - ]; - - // The name of the latest conversation message used as context for - // compiling suggestion. If empty, the latest message of the conversation will - // be used. - // - // Format: `projects//locations//conversations//messages/`. - string latest_message = 3 [(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 500 and at most 1000. - int32 context_size = 4; -} - -// The response message for [Conversations.SuggestConversationSummary][google.cloud.dialogflow.v2beta1.Conversations.SuggestConversationSummary]. -message SuggestConversationSummaryResponse { - // Generated summary for a conversation. - message Summary { - // The summary content that is concatenated into one string. - string text = 1; - - // The summary content that is divided into sections. The key is the - // section's name and the value is the section's content. There is no - // specific format for the key or value. - map text_sections = 4; - - // The name of the answer record. Format: - // "projects//answerRecords/" - string answer_record = 3 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/AnswerRecord" - }]; - } - - // Generated summary. - Summary summary = 1; - - // The name of the latest conversation message used as context for - // compiling suggestion. - // - // Format: `projects//locations//conversations//messages/`. - string latest_message = 2 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Message" - }]; - - // Number of messages prior to and including - // [last_conversation_message][] used to compile the suggestion. It may be - // smaller than the [SuggestSummaryRequest.context_size][] field in the - // request if there weren't that many messages in the conversation. - int32 context_size = 3; -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_event.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_event.proto deleted file mode 100644 index 7f47dcee08a..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_event.proto +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2022 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"; - -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 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.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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto deleted file mode 100644 index 0c1f5529620..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto +++ /dev/null @@ -1,735 +0,0 @@ -// Copyright 2022 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/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"; - } - - // Adds or updates a suggestion feature in a conversation profile. - // If the conversation profile contains the type of suggestion feature for - // the participant role, it will update it. Otherwise it will insert the - // suggestion feature. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: [SetSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata] - // - `response`: [ConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfile] - // - // If a long running operation to add or update suggestion feature - // config for the same conversation profile, participant role and suggestion - // feature type exists, please cancel the existing long running operation - // before sending such request, otherwise the request will be rejected. - rpc SetSuggestionFeatureConfig(SetSuggestionFeatureConfigRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2beta1/{conversation_profile=projects/*/conversationProfiles/*}:setSuggestionFeatureConfig" - body: "*" - additional_bindings { - post: "/v2beta1/{conversation_profile=projects/*/locations/*/conversationProfiles/*}:setSuggestionFeatureConfig" - body: "*" - } - }; - option (google.api.method_signature) = "conversation_profile"; - option (google.longrunning.operation_info) = { - response_type: "ConversationProfile" - metadata_type: "SetSuggestionFeatureConfigOperationMetadata" - }; - } - - // Clears a suggestion feature from a conversation profile for the given - // participant role. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: [ClearSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata] - // - `response`: [ConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfile] - rpc ClearSuggestionFeatureConfig(ClearSuggestionFeatureConfigRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2beta1/{conversation_profile=projects/*/conversationProfiles/*}:clearSuggestionFeatureConfig" - body: "*" - additional_bindings { - post: "/v2beta1/{conversation_profile=projects/*/locations/*/conversationProfiles/*}:clearSuggestionFeatureConfig" - body: "*" - } - }; - option (google.api.method_signature) = "conversation_profile"; - option (google.longrunning.operation_info) = { - response_type: "ConversationProfile" - metadata_type: "ClearSuggestionFeatureConfigOperationMetadata" - }; - } -} - -// 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. - // This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) - // language tag. Example: "en-US". - string language_code = 10; - - // The time zone of this conversational profile from the - // [time zone database](https://www.iana.org/time-zones), e.g., - // America/New_York, Europe/Paris. Defaults to America/New_York. - string time_zone = 14; - - // Name of the CX SecuritySettings reference for the agent. - // Format: `projects//locations//securitySettings/`. - string security_settings = 13 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/CXSecuritySettings" - }]; -} - -// 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; - - // Configs for processing conversation. - ConversationProcessConfig conversation_process_config = 8; - } - - // 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, - // CONVERSATION_SUMMARIZATION. - message ConversationModelConfig { - // Conversation model resource name. Format: `projects//conversationModels/`. - string model = 1 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/ConversationModel" - }]; - } - - // Config to process conversation. - message ConversationProcessConfig { - // Number of recent non-small-talk sentences to use as context for article - // and FAQ suggestion - int32 recent_sentences_count = 2; - } - - // 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. - // - // For telephony integration to receive notification, make sure either this - // topic 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. - // - // For chat integration to receive notification, make sure API caller has been - // granted the `Dialogflow Service Agent` role for the topic. - // - // 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" - } - ]; -} - -// The request message for -// [ConversationProfiles.SetSuggestionFeature][]. -message SetSuggestionFeatureConfigRequest { - // Required. The Conversation Profile to add or update the suggestion feature - // config. Format: `projects//locations//conversationProfiles/`. - string conversation_profile = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The participant role to add or update the suggestion feature - // config. Only HUMAN_AGENT or END_USER can be used. - Participant.Role participant_role = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The suggestion feature config to add or update. - HumanAgentAssistantConfig.SuggestionFeatureConfig suggestion_feature_config = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for [ConversationProfiles.ClearFeature][]. -message ClearSuggestionFeatureConfigRequest { - // Required. The Conversation Profile to add or update the suggestion feature - // config. Format: `projects//locations//conversationProfiles/`. - string conversation_profile = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The participant role to remove the suggestion feature - // config. Only HUMAN_AGENT or END_USER can be used. - Participant.Role participant_role = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The type of the suggestion feature to remove. - SuggestionFeature.Type suggestion_feature_type = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Metadata for a [ConversationProfile.SetSuggestionFeatureConfig][] -// operation. -message SetSuggestionFeatureConfigOperationMetadata { - // The resource name of the conversation profile. Format: - // `projects//locations//conversationProfiles/` - string conversation_profile = 1; - - // Required. The participant role to add or update the suggestion feature - // config. Only HUMAN_AGENT or END_USER can be used. - Participant.Role participant_role = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The type of the suggestion feature to add or update. - SuggestionFeature.Type suggestion_feature_type = 3 [(google.api.field_behavior) = REQUIRED]; - - // Timestamp whe the request was created. The time is measured on server side. - google.protobuf.Timestamp create_time = 4; -} - -// Metadata for a [ConversationProfile.ClearSuggestionFeatureConfig][] -// operation. -message ClearSuggestionFeatureConfigOperationMetadata { - // The resource name of the conversation profile. Format: - // `projects//locations//conversationProfiles/` - string conversation_profile = 1; - - // Required. The participant role to remove the suggestion feature - // config. Only HUMAN_AGENT or END_USER can be used. - Participant.Role participant_role = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The type of the suggestion feature to remove. - SuggestionFeature.Type suggestion_feature_type = 3 [(google.api.field_behavior) = REQUIRED]; - - // Timestamp whe the request was created. The time is measured on server side. - google.protobuf.Timestamp create_time = 4; -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/document.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/document.proto deleted file mode 100644 index 9ecdb5fb54c..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/document.proto +++ /dev/null @@ -1,612 +0,0 @@ -// Copyright 2022 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/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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] - // - `response`: [Document][google.cloud.dialogflow.v2beta1.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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] - // - `response`: [ImportDocumentsResponse][google.cloud.dialogflow.v2beta1.ImportDocumentsResponse] - 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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] - // - `response`: An [Empty - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - // - // 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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] - // - `response`: [Document][google.cloud.dialogflow.v2beta1.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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] - // - `response`: [Document][google.cloud.dialogflow.v2beta1.Document] - // - // 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 knowledge type of document content. - enum KnowledgeType { - option allow_alias = true; - - // 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 document contains agent-facing Smart Reply entries. - AGENT_FACING_SMART_REPLY = 4; - - // The legacy enum for agent-facing smart reply feature. - SMART_REPLY = 4; - } - - // 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; - } - - // Possible states of the document - enum State { - // The document state is unspecified. - STATE_UNSPECIFIED = 0; - - // The document creation is in progress. - CREATING = 1; - - // The document is active and ready to use. - ACTIVE = 2; - - // The document updation is in progress. - UPDATING = 3; - - // The document is reloading. - RELOADING = 4; - - // The document deletion is in progress. - DELETING = 5; - } - - // 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. PERMISSION_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]; - - // Output only. The current state of the document. - State state = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// 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 related to the Export Data Operations (e.g. ExportDocument). -message ExportOperationMetadata { - // Cloud Storage file path of the exported data. - GcsDestination exported_gcs_destination = 1; -} - -// 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]; - - // The name of the knowledge base interacted with during the operation. - string knowledge_base = 3; - - // Additional metadata for the Knowledge operation. - oneof operation_metadata { - // Metadata for the Export Data Operation such as the destination of export. - ExportOperationMetadata export_operation_metadata = 4; - } -} - -// 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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/entity_type.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/entity_type.proto deleted file mode 100644 index 7bffded54b6..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/entity_type.proto +++ /dev/null @@ -1,639 +0,0 @@ -// Copyright 2022 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. - // - // 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: "/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. - // - // 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: "/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. - // - // 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: "/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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: An empty [Struct - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - // - `response`: [BatchUpdateEntityTypesResponse][google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse] - // - // 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: "/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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: An empty [Struct - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - // - `response`: An [Empty - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - // - // 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: "/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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: An empty [Struct - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - // - `response`: An [Empty - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - // - // 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: "/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. - // - // Note: You should always train an agent prior to sending it queries. See the - // [training - // documentation](https://cloud.google.com/dialogflow/es/docs/training). - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: An empty [Struct - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - // - `response`: An [Empty - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - 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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: An empty [Struct - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - // - `response`: An [Empty - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - // - // 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: "/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}" - }; - - // 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; - } - - // 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; - } - - // 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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/environment.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/environment.proto deleted file mode 100644 index dd95cab9af3..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/environment.proto +++ /dev/null @@ -1,372 +0,0 @@ -// Copyright 2022 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, - (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.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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/fulfillment.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/fulfillment.proto deleted file mode 100644 index 8efe32af2f0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/fulfillment.proto +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright 2022 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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/gcs.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/gcs.proto deleted file mode 100644 index debb5786c06..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/gcs.proto +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 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"; - -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; -} - -// Google Cloud Storage location for the output. -message GcsDestination { - // Required. The Google Cloud Storage URIs for the output. A URI is of the - // form: - // gs://bucket/object-prefix-or-name - // Whether a prefix or name is used depends on the use case. The requesting - // user must have "write-permission" to the bucket. - string uri = 1; -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto deleted file mode 100644 index 9716f74e5b0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2022 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"; - -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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/intent.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/intent.proto deleted file mode 100644 index 99e9cafd762..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/intent.proto +++ /dev/null @@ -1,1453 +0,0 @@ -// Copyright 2022 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/context.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/struct.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; -option java_multiple_files = true; -option java_outer_classname = "IntentProto"; -option java_package = "com.google.cloud.dialogflow.v2beta1"; -option objc_class_prefix = "DF"; - -// 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. - // - // 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: "/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. - // - // 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: "/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. - // - // 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: "/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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: An empty [Struct - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - // - `response`: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse] - // - // 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: "/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. - // - // This method is a [long-running - // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - // The returned `Operation` type has the following method-specific fields: - // - // - `metadata`: An empty [Struct - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - // - `response`: An [Empty - // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - // - // 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: "/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 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; - } - - // Represents an example that the agent is trained on. - message TrainingPhrase { - // 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. - // Note: Template mode has been deprecated. Example mode is the only - // supported way to create new training phrases. If you have existing - // training phrases in template mode, they will be removed during training - // and it can cause a drop in agent performance. - TEMPLATE = 2 [deprecated = true]; - } - - // 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; - } - - // 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 { - // 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; - } - - // 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 { - // Format of response media type. - enum ResponseMediaType { - // Unspecified. - RESPONSE_MEDIA_TYPE_UNSPECIFIED = 0; - - // Response media type is audio. - AUDIO = 1; - } - - // 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; - } - - // 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; - } - - // 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; - } - - // 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]; -} - -// 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; -} - -// This message is a wrapper around a collection of intents. -message IntentBatch { - // A collection of intents. - repeated Intent intents = 1; -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto deleted file mode 100644 index cf5c21ddee4..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto +++ /dev/null @@ -1,278 +0,0 @@ -// Copyright 2022 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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/participant.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/participant.proto deleted file mode 100644 index 887a84015ce..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/participant.proto +++ /dev/null @@ -1,1429 +0,0 @@ -// Copyright 2022 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/session.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,audio_input"; - option (google.api.method_signature) = "participant,event_input"; - } - - // Adds a text (e.g., chat) or audio (e.g., phone recording) message from a - // participant into the conversation. - // Note: This method is only available through the gRPC API (not REST). - // - // The top-level message sent to the client by the server is - // `StreamingAnalyzeContentResponse`. Multiple response messages can be - // returned in order. The first one or more messages contain the - // `recognition_result` field. Each result represents a more complete - // transcript of what the user said. The next message contains the - // `reply_text` field, and potentially the `reply_audio` and/or the - // `automated_agent_reply` fields. - // - // 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 StreamingAnalyzeContent(stream StreamingAnalyzeContentRequest) returns (stream StreamingAnalyzeContentResponse) { - } - - // 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]; - - // Optional. Key-value filters on the metadata of documents returned by article - // suggestion. If specified, article suggestion only returns suggested - // documents that match all filters in their [Document.metadata][google.cloud.dialogflow.v2beta1.Document.metadata]. Multiple - // values for a metadata key should be concatenated by comma. For example, - // filters to match all documents that have 'US' or 'CA' in their market - // metadata values and 'agent' in their user metadata values will be - // ``` - // documents_metadata_filters { - // key: "market" - // value: "US,CA" - // } - // documents_metadata_filters { - // key: "user" - // value: "agent" - // } - // ``` - map documents_metadata_filters = 8 [(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 processed. -message AudioInput { - // Required. Instructs the speech recognizer how to process the speech audio. - InputAudioConfig config = 1; - - // Required. The natural language speech audio to be processed. - // A single request can contain up to 1 minute of speech audio data. - // The transcribed text cannot contain more than 256 bytes for virtual agent - // interactions. - bytes audio = 2; -} - -// 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 unique identifier of the current Dialogflow CX conversation page. - // Format: `projects//locations//agents//flows//pages/`. - string cx_current_page = 11; -} - -// 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 for chat. - ARTICLE_SUGGESTION = 1; - - // Run FAQ model. - FAQ = 2; - - // Run smart reply model for chat. - SMART_REPLY = 3; - - // Run conversation summarization model for chat. - CONVERSATION_SUMMARIZATION = 8; - } - - // Type of Human Agent Assistant API feature to request. - Type type = 1; -} - -// Represents the parameters of human assist query. -message AssistQueryParameters { - // Key-value filters on the metadata of documents returned by article - // suggestion. If specified, article suggestion only returns suggested - // documents that match all filters in their [Document.metadata][google.cloud.dialogflow.v2beta1.Document.metadata]. Multiple - // values for a metadata key should be concatenated by comma. For example, - // filters to match all documents that have 'US' or 'CA' in their market - // metadata values and 'agent' in their user metadata values will be - // ``` - // documents_metadata_filters { - // key: "market" - // value: "US,CA" - // } - // documents_metadata_filters { - // key: "user" - // value: "agent" - // } - // ``` - map documents_metadata_filters = 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; - - // The natural language speech audio to be processed. - AudioInput audio_input = 7; - - // 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; - - // Parameters for a human assist query. - AssistQueryParameters assist_query_params = 14; - - // Additional parameters to be put into Dialogflow CX session parameters. To - // remove a parameter from the session, clients should explicitly set the - // parameter value to null. - // - // Note: this field should only be used if you are connecting to a Dialogflow - // CX agent. - google.protobuf.Struct cx_parameters = 18; - - // The unique identifier of the CX page to override the `current_page` in the - // session. - // Format: `projects//locations//agents//flows//pages/`. - // - // If `cx_current_page` is specified, the previous state of the session will - // be ignored by Dialogflow CX, including the [previous - // page][QueryResult.current_page] and the [previous session - // parameters][QueryResult.parameters]. In most cases, `cx_current_page` and - // `cx_parameters` should be configured together to direct a session to a - // specific state. - // - // Note: this field should only be used if you are connecting to a Dialogflow - // CX agent. - string cx_current_page = 20; - - // 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]. - // - // Note that any failure of Agent Assist features will not lead to the overall - // failure of an AnalyzeContent API call. Instead, the features will - // fail silently with the error field set in the corresponding - // SuggestionResult. - 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]. - // - // Same as human_agent_suggestion_results, any failure of Agent Assist - // features will not lead to the overall failure of an AnalyzeContent API - // call. Instead, the features will fail silently with the error field set in - // the corresponding SuggestionResult. - repeated SuggestionResult end_user_suggestion_results = 7; - - // Indicates the parameters of DTMF. - DtmfParameters dtmf_parameters = 9; -} - -// Defines the language used in the input text. -message InputTextConfig { - // 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. - string language_code = 1; -} - -// The top-level message sent by the client to the -// [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent] method. -// -// Multiple request messages should be sent in order: -// -// 1. The first message must contain -// [participant][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.participant], -// [config][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.config] and optionally -// [query_params][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.query_params]. If you want -// to receive an audio response, it should also contain -// [reply_audio_config][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.reply_audio_config]. -// The message must not contain -// [input][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.input]. -// -// 2. If [config][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.config] in the first message -// was set to [audio_config][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.audio_config], -// all subsequent messages must contain -// [input_audio][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.input_audio] to continue -// with Speech recognition. -// If you decide to rather analyze text input after you already started -// Speech recognition, please send a message with -// [StreamingAnalyzeContentRequest.input_text][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.input_text]. -// -// However, note that: -// -// * Dialogflow will bill you for the audio so far. -// * Dialogflow discards all Speech recognition results in favor of the -// text input. -// -// 3. If [StreamingAnalyzeContentRequest.config][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.config] in the first message was set -// to [StreamingAnalyzeContentRequest.text_config][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.text_config], then the second message -// must contain only [input_text][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.input_text]. -// Moreover, you must not send more than two messages. -// -// After you sent all input, you must half-close or abort the request stream. -message StreamingAnalyzeContentRequest { - // 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 config. - oneof config { - // Instructs the speech recognizer how to process the speech audio. - InputAudioConfig audio_config = 2; - - // The natural language text to be processed. - InputTextConfig text_config = 3; - } - - // 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 - // StreamingAnalyzeContent. If this configuration is not supplied, speech - // synthesis is disabled. - OutputAudioConfig reply_audio_config = 4; - - // Required. The input. - oneof input { - // The input audio content to be recognized. Must be sent if `audio_config` - // is set in the first message. The complete audio over all streaming - // messages must not exceed 1 minute. - bytes input_audio = 5; - - // The UTF-8 encoded natural language text to be processed. Must be sent if - // `text_config` is set in the first message. Text length must not exceed - // 256 bytes for virtual agent interactions. The `input_text` field can be - // only sent once. - string input_text = 6; - - // The DTMF digits used to invoke intent and fill in parameter value. - // - // This input is ignored if the previous response indicated that DTMF input - // is not accepted. - TelephonyDtmfEvents input_dtmf = 9; - } - - // Parameters for a Dialogflow virtual-agent query. - QueryParameters query_params = 7; - - // Parameters for a human assist query. - AssistQueryParameters assist_query_params = 8; - - // Additional parameters to be put into Dialogflow CX session parameters. To - // remove a parameter from the session, clients should explicitly set the - // parameter value to null. - // - // Note: this field should only be used if you are connecting to a Dialogflow - // CX agent. - google.protobuf.Struct cx_parameters = 13; - - // The unique identifier of the CX page to override the `current_page` in the - // session. - // Format: `projects//locations//agents//flows//pages/`. - // - // If `cx_current_page` is specified, the previous state of the session will - // be ignored by Dialogflow CX, including the [previous - // page][QueryResult.current_page] and the [previous session - // parameters][QueryResult.parameters]. In most cases, `cx_current_page` and - // `cx_parameters` should be configured together to direct a session to a - // specific state. - // - // Note: this field should only be used if you are connecting to a Dialogflow - // CX agent. - string cx_current_page = 15; - - // Enable partial virtual agent responses. If this flag is not enabled, - // response stream still contains only one final response even if some - // `Fulfillment`s in Dialogflow virtual agent have been configured to return - // partial responses. - bool enable_partial_automated_agent_reply = 12; -} - -// The top-level message returned from the `StreamingAnalyzeContent` 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. In virtual agent stage: if `enable_partial_automated_agent_reply` is -// true, the following N (currently 1 <= N <= 4) messages -// contain `automated_agent_reply` and optionally `reply_audio` -// returned by the virtual agent. The first (N-1) -// `automated_agent_reply`s will have `automated_agent_reply_type` set to -// `PARTIAL`. The last `automated_agent_reply` has -// `automated_agent_reply_type` set to `FINAL`. -// If `enable_partial_automated_agent_reply` is not enabled, response stream -// only contains the final reply. -// -// In human assist stage: the following N (N >= 1) messages contain -// `human_agent_suggestion_results`, `end_user_suggestion_results` or -// `message`. -message StreamingAnalyzeContentResponse { - // The result of speech recognition. - StreamingRecognitionResult recognition_result = 1; - - // Optional. The output text content. - // This field is set if an automated agent responded with a text for the user. - string reply_text = 2; - - // Optional. The audio data bytes encoded as specified in the request. - // This field is set if: - // - // - The `reply_audio_config` field is specified in the request. - // - The automated agent, which this output comes from, responded with audio. - // In such case, the `reply_audio.config` field 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 = 3; - - // 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.StreamingAnalyzeContentResponse.reply_audio] instead. - AutomatedAgentReply automated_agent_reply = 4; - - // Output only. Message analyzed by CCAI. - Message message = 6; - - // 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 = 7; - - // 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 = 8; - - // Indicates the parameters of DTMF. - DtmfParameters dtmf_parameters = 10; -} - -// 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 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/AnswerRecord" - }]; -} - -// 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]; - - // Optional. Parameters for a human assist query. - AssistQueryParameters assist_query_params = 4 [(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]; - - // Optional. Parameters for a human assist query. - AssistQueryParameters assist_query_params = 4 [(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 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Message" - }]; - - // 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 { - - } - - // Represents an audio message that is composed of both segments - // synthesized from the Dialogflow agent prompts and ones hosted externally - // at the specified URIs. - message MixedAudio { - // Represents one segment of audio. - message Segment { - // Content of the segment. - oneof content { - // Raw audio synthesized from the Dialogflow agent's response using - // the output config specified in the request. - bytes audio = 1; - - // Client-specific URI that points to an audio clip accessible to the - // client. - string uri = 2; - } - - // Whether the playback of this segment can be interrupted by the end - // user's speech and the client should then start the next Dialogflow - // request. - bool allow_playback_interruption = 3; - } - - // Segments this audio response is composed of. - repeated Segment segments = 1; - } - - // Represents the signal that telles the client to transfer the phone call - // connected to the agent to a third-party endpoint. - message TelephonyTransferCall { - // Endpoint to transfer the call to. - oneof endpoint { - // Transfer the call to a phone number - // in [E.164 format](https://en.wikipedia.org/wiki/E.164). - string phone_number = 1; - - // Transfer the call to a SIP endpoint. - string sip_uri = 2; - } - } - - // 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; - - // An audio response message composed of both the synthesized Dialogflow - // agent responses and the audios hosted in places known to the client. - MixedAudio mixed_audio = 5; - - // A signal that the client should transfer the phone call connected to - // this agent to a third-party endpoint. - TelephonyTransferCall telephony_transfer_call = 6; - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/session.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/session.proto deleted file mode 100644 index 4f45bce45bb..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/session.proto +++ /dev/null @@ -1,841 +0,0 @@ -// Copyright 2022 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/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. - // - // If you might use - // [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) - // or other CCAI products now or in the future, consider using - // [AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent] - // instead of `DetectIntent`. `AnalyzeContent` has additional - // functionality for Agent Assist and other CCAI products. - // - // 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). - // - // If you might use - // [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) - // or other CCAI products now or in the future, consider using - // [StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent] - // instead of `StreamingDetectIntent`. `StreamingAnalyzeContent` has - // additional functionality for Agent Assist and other CCAI products. - // - // 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. For more information, see the [cancel slot filling - // documentation](https://cloud.google.com/dialogflow/es/docs/intents-actions-parameters#cancel). - 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 `StreamingDetectIntentRequest.input_audio` field was -// set, the `recognition_result` field is populated for one -// or more messages. -// See the [StreamingRecognitionResult][google.cloud.dialogflow.v2beta1.StreamingRecognitionResult] message for details -// about the result message sequence. -// -// 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. -// -// While end-user audio is being processed, Dialogflow sends a series of -// results. Each result may contain a `transcript` value. A transcript -// represents a portion of the utterance. While the recognizer is processing -// audio, transcript values may be interim values or finalized values. -// Once a transcript is finalized, the `is_final` value is set to true and -// processing continues for the next transcript. -// -// If `StreamingDetectIntentRequest.query_input.audio_config.single_utterance` -// was true, and the recognizer has completed processing audio, -// the `message_type` value is set to `END_OF_SINGLE_UTTERANCE and the -// following (last) result contains the last finalized transcript. -// -// The complete end-user utterance is determined by concatenating the -// finalized transcript values received for the series of results. -// -// In the following example, single utterance is enabled. In the case where -// single utterance is not enabled, result 7 would not occur. -// -// ``` -// Num | transcript | message_type | is_final -// --- | ----------------------- | ----------------------- | -------- -// 1 | "tube" | TRANSCRIPT | false -// 2 | "to be a" | TRANSCRIPT | false -// 3 | "to be" | TRANSCRIPT | false -// 4 | "to be or not to be" | TRANSCRIPT | true -// 5 | "that's" | TRANSCRIPT | false -// 6 | "that is | TRANSCRIPT | false -// 7 | unset | END_OF_SINGLE_UTTERANCE | unset -// 8 | " that is the question" | TRANSCRIPT | true -// ``` -// -// Concatenating the finalized transcripts with `is_final` set to true, -// the complete utterance becomes "to be or not to be that is the question". -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; - - // Detected language code for the transcript. - string language_code = 10; - - // 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 for virtual agent interactions. - 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. - // - // This field is ignored when used in the context of a - // [WebhookResponse.followup_event_input][google.cloud.dialogflow.v2beta1.WebhookResponse.followup_event_input] field, - // because the language was already defined in the originating detect - // intent request. - 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. See: -// https://cloud.google.com/natural-language/docs/basics#interpreting_sentiment_analysis_values -// for how to interpret the result. -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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto deleted file mode 100644 index 4b1c5873d26..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto +++ /dev/null @@ -1,351 +0,0 @@ -// Copyright 2022 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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/validation_result.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/validation_result.proto deleted file mode 100644 index d3882b9fae2..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/validation_result.proto +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2022 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; - -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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/version.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/version.proto deleted file mode 100644 index 58b4b5bbf71..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/version.proto +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright 2022 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/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/webhook.proto b/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/webhook.proto deleted file mode 100644 index a566c5ccc8e..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/protos/google/cloud/dialogflow/v2beta1/webhook.proto +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright 2022 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"; - -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/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.delete_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.delete_agent.js deleted file mode 100644 index 7568a097c38..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.delete_agent.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_Agents_DeleteAgent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project that the agent to delete is associated with. - * Format: `projects/` or - * `projects//locations/`. - */ - // const parent = 'abc123' - - // Imports the Dialogflow library - const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new AgentsClient(); - - async function callDeleteAgent() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await dialogflowClient.deleteAgent(request); - console.log(response); - } - - callDeleteAgent(); - // [END dialogflow_v2beta1_generated_Agents_DeleteAgent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.export_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.export_agent.js deleted file mode 100644 index bcfceaf88ab..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.export_agent.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_Agents_ExportAgent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project that the agent to export is associated with. - * Format: `projects/` or - * `projects//locations/`. - */ - // const parent = 'abc123' - /** - * 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. - * Dialogflow performs a write operation for the Cloud Storage object - * on the caller's behalf, so your request authentication must - * have write permissions for the object. For more information, see - * Dialogflow access - * control (https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). - */ - // const agentUri = 'abc123' - - // Imports the Dialogflow library - const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new AgentsClient(); - - async function callExportAgent() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await dialogflowClient.exportAgent(request); - const [response] = await operation.promise(); - console.log(response); - } - - callExportAgent(); - // [END dialogflow_v2beta1_generated_Agents_ExportAgent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.get_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.get_agent.js deleted file mode 100644 index a6bca6a47b6..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.get_agent.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_Agents_GetAgent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project that the agent to fetch is associated with. - * Format: `projects/` or - * `projects//locations/`. - */ - // const parent = 'abc123' - - // Imports the Dialogflow library - const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new AgentsClient(); - - async function callGetAgent() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await dialogflowClient.getAgent(request); - console.log(response); - } - - callGetAgent(); - // [END dialogflow_v2beta1_generated_Agents_GetAgent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.get_validation_result.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.get_validation_result.js deleted file mode 100644 index 2b0ded3b158..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.get_validation_result.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_Agents_GetValidationResult_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project that the agent is associated with. - * Format: `projects/` or - * `projects//locations/`. - */ - // const parent = 'abc123' - /** - * 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. - */ - // const languageCode = 'abc123' - - // Imports the Dialogflow library - const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new AgentsClient(); - - async function callGetValidationResult() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await dialogflowClient.getValidationResult(request); - console.log(response); - } - - callGetValidationResult(); - // [END dialogflow_v2beta1_generated_Agents_GetValidationResult_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.import_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.import_agent.js deleted file mode 100644 index 0e5cc2a7e94..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.import_agent.js +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_Agents_ImportAgent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project that the agent to import is associated with. - * Format: `projects/` or - * `projects//locations/`. - */ - // const parent = 'abc123' - /** - * The URI to a Google Cloud Storage file containing the agent to import. - * Note: The URI must start with "gs://". - * Dialogflow performs a read operation for the Cloud Storage object - * on the caller's behalf, so your request authentication must - * have read permissions for the object. For more information, see - * Dialogflow access - * control (https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). - */ - // const agentUri = 'abc123' - /** - * Zip compressed raw byte content for agent. - */ - // const agentContent = 'Buffer.from('string')' - - // Imports the Dialogflow library - const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new AgentsClient(); - - async function callImportAgent() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await dialogflowClient.importAgent(request); - const [response] = await operation.promise(); - console.log(response); - } - - callImportAgent(); - // [END dialogflow_v2beta1_generated_Agents_ImportAgent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.restore_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.restore_agent.js deleted file mode 100644 index 827e0e509eb..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.restore_agent.js +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_Agents_RestoreAgent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project that the agent to restore is associated with. - * Format: `projects/` or - * `projects//locations/`. - */ - // const parent = 'abc123' - /** - * The URI to a Google Cloud Storage file containing the agent to restore. - * Note: The URI must start with "gs://". - * Dialogflow performs a read operation for the Cloud Storage object - * on the caller's behalf, so your request authentication must - * have read permissions for the object. For more information, see - * Dialogflow access - * control (https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). - */ - // const agentUri = 'abc123' - /** - * Zip compressed raw byte content for agent. - */ - // const agentContent = 'Buffer.from('string')' - - // Imports the Dialogflow library - const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new AgentsClient(); - - async function callRestoreAgent() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await dialogflowClient.restoreAgent(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRestoreAgent(); - // [END dialogflow_v2beta1_generated_Agents_RestoreAgent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.search_agents.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.search_agents.js deleted file mode 100644 index 55792ca6aee..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.search_agents.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_Agents_SearchAgents_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project to list agents from. - * Format: `projects/` or - * `projects//locations/`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new AgentsClient(); - - async function callSearchAgents() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.searchAgentsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callSearchAgents(); - // [END dialogflow_v2beta1_generated_Agents_SearchAgents_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.set_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.set_agent.js deleted file mode 100644 index 09788da9aa9..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.set_agent.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 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'; - -function main(agent) { - // [START dialogflow_v2beta1_generated_Agents_SetAgent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The agent to update. - */ - // const agent = {} - /** - * Optional. The mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new AgentsClient(); - - async function callSetAgent() { - // Construct request - const request = { - agent, - }; - - // Run request - const response = await dialogflowClient.setAgent(request); - console.log(response); - } - - callSetAgent(); - // [END dialogflow_v2beta1_generated_Agents_SetAgent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.train_agent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.train_agent.js deleted file mode 100644 index 4451ade78cf..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/agents.train_agent.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_Agents_TrainAgent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project that the agent to train is associated with. - * Format: `projects/` or - * `projects//locations/`. - */ - // const parent = 'abc123' - - // Imports the Dialogflow library - const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new AgentsClient(); - - async function callTrainAgent() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await dialogflowClient.trainAgent(request); - const [response] = await operation.promise(); - console.log(response); - } - - callTrainAgent(); - // [END dialogflow_v2beta1_generated_Agents_TrainAgent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/answer_records.get_answer_record.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/answer_records.get_answer_record.js deleted file mode 100644 index 246fb647b86..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/answer_records.get_answer_record.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2022 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'; - -function main() { - // [START dialogflow_v2beta1_generated_AnswerRecords_GetAnswerRecord_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the answer record to retrieve. - * Format: `projects//locations//answerRecords/`. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {AnswerRecordsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new AnswerRecordsClient(); - - async function callGetAnswerRecord() { - // Construct request - const request = { - }; - - // Run request - const response = await dialogflowClient.getAnswerRecord(request); - console.log(response); - } - - callGetAnswerRecord(); - // [END dialogflow_v2beta1_generated_AnswerRecords_GetAnswerRecord_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/answer_records.list_answer_records.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/answer_records.list_answer_records.js deleted file mode 100644 index 6e8f2d41f58..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/answer_records.list_answer_records.js +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2022 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'; - -function main() { - // [START dialogflow_v2beta1_generated_AnswerRecords_ListAnswerRecords_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project to list all answer records for in reverse - * chronological order. Format: `projects//locations/`. - */ - // const parent = 'abc123' - /** - * Optional. Filters to restrict results to specific answer records. - * For more information about filtering, see - * API Filtering (https://aip.dev/160). - */ - // const filter = 'abc123' - /** - * 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. - */ - // const pageSize = 1234 - /** - * 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. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {AnswerRecordsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new AnswerRecordsClient(); - - async function callListAnswerRecords() { - // Construct request - const request = { - }; - - // Run request - const iterable = await dialogflowClient.listAnswerRecordsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAnswerRecords(); - // [END dialogflow_v2beta1_generated_AnswerRecords_ListAnswerRecords_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/answer_records.update_answer_record.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/answer_records.update_answer_record.js deleted file mode 100644 index 904438926c3..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/answer_records.update_answer_record.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 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'; - -function main(answerRecord) { - // [START dialogflow_v2beta1_generated_AnswerRecords_UpdateAnswerRecord_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Answer record to update. - */ - // const answerRecord = {} - /** - * Required. The mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {AnswerRecordsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new AnswerRecordsClient(); - - async function callUpdateAnswerRecord() { - // Construct request - const request = { - answerRecord, - }; - - // Run request - const response = await dialogflowClient.updateAnswerRecord(request); - console.log(response); - } - - callUpdateAnswerRecord(); - // [END dialogflow_v2beta1_generated_AnswerRecords_UpdateAnswerRecord_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.create_context.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.create_context.js deleted file mode 100644 index f75ab2546eb..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.create_context.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, context) { - // [START dialogflow_v2beta1_generated_Contexts_CreateContext_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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. - */ - // const parent = 'abc123' - /** - * Required. The context to create. - */ - // const context = {} - - // Imports the Dialogflow library - const {ContextsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ContextsClient(); - - async function callCreateContext() { - // Construct request - const request = { - parent, - context, - }; - - // Run request - const response = await dialogflowClient.createContext(request); - console.log(response); - } - - callCreateContext(); - // [END dialogflow_v2beta1_generated_Contexts_CreateContext_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.delete_all_contexts.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.delete_all_contexts.js deleted file mode 100644 index 5d804090ffc..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.delete_all_contexts.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_Contexts_DeleteAllContexts_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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. - */ - // const parent = 'abc123' - - // Imports the Dialogflow library - const {ContextsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ContextsClient(); - - async function callDeleteAllContexts() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await dialogflowClient.deleteAllContexts(request); - console.log(response); - } - - callDeleteAllContexts(); - // [END dialogflow_v2beta1_generated_Contexts_DeleteAllContexts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.delete_context.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.delete_context.js deleted file mode 100644 index 358c10041f9..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.delete_context.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2beta1_generated_Contexts_DeleteContext_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {ContextsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ContextsClient(); - - async function callDeleteContext() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.deleteContext(request); - console.log(response); - } - - callDeleteContext(); - // [END dialogflow_v2beta1_generated_Contexts_DeleteContext_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.get_context.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.get_context.js deleted file mode 100644 index 900998726cc..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.get_context.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2beta1_generated_Contexts_GetContext_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {ContextsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ContextsClient(); - - async function callGetContext() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getContext(request); - console.log(response); - } - - callGetContext(); - // [END dialogflow_v2beta1_generated_Contexts_GetContext_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.list_contexts.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.list_contexts.js deleted file mode 100644 index 64fabb5b2cb..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.list_contexts.js +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_Contexts_ListContexts_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {ContextsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ContextsClient(); - - async function callListContexts() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listContextsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListContexts(); - // [END dialogflow_v2beta1_generated_Contexts_ListContexts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.update_context.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.update_context.js deleted file mode 100644 index b8670e512db..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/contexts.update_context.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 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'; - -function main(context) { - // [START dialogflow_v2beta1_generated_Contexts_UpdateContext_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The context to update. - */ - // const context = {} - /** - * Optional. The mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {ContextsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ContextsClient(); - - async function callUpdateContext() { - // Construct request - const request = { - context, - }; - - // Run request - const response = await dialogflowClient.updateContext(request); - console.log(response); - } - - callUpdateContext(); - // [END dialogflow_v2beta1_generated_Contexts_UpdateContext_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.clear_suggestion_feature_config.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.clear_suggestion_feature_config.js deleted file mode 100644 index 46ab5c9bc5f..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.clear_suggestion_feature_config.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2022 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'; - -function main(conversationProfile, participantRole, suggestionFeatureType) { - // [START dialogflow_v2beta1_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Conversation Profile to add or update the suggestion feature - * config. Format: `projects//locations//conversationProfiles/`. - */ - // const conversationProfile = 'abc123' - /** - * Required. The participant role to remove the suggestion feature - * config. Only HUMAN_AGENT or END_USER can be used. - */ - // const participantRole = {} - /** - * Required. The type of the suggestion feature to remove. - */ - // const suggestionFeatureType = {} - - // Imports the Dialogflow library - const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ConversationProfilesClient(); - - async function callClearSuggestionFeatureConfig() { - // Construct request - const request = { - conversationProfile, - participantRole, - suggestionFeatureType, - }; - - // Run request - const [operation] = await dialogflowClient.clearSuggestionFeatureConfig(request); - const [response] = await operation.promise(); - console.log(response); - } - - callClearSuggestionFeatureConfig(); - // [END dialogflow_v2beta1_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.create_conversation_profile.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.create_conversation_profile.js deleted file mode 100644 index 2aa68468163..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.create_conversation_profile.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, conversationProfile) { - // [START dialogflow_v2beta1_generated_ConversationProfiles_CreateConversationProfile_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project to create a conversation profile for. - * Format: `projects//locations/`. - */ - // const parent = 'abc123' - /** - * Required. The conversation profile to create. - */ - // const conversationProfile = {} - - // Imports the Dialogflow library - const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ConversationProfilesClient(); - - async function callCreateConversationProfile() { - // Construct request - const request = { - parent, - conversationProfile, - }; - - // Run request - const response = await dialogflowClient.createConversationProfile(request); - console.log(response); - } - - callCreateConversationProfile(); - // [END dialogflow_v2beta1_generated_ConversationProfiles_CreateConversationProfile_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.delete_conversation_profile.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.delete_conversation_profile.js deleted file mode 100644 index ed1539ec95a..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.delete_conversation_profile.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2beta1_generated_ConversationProfiles_DeleteConversationProfile_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the conversation profile to delete. - * Format: `projects//locations//conversationProfiles/`. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ConversationProfilesClient(); - - async function callDeleteConversationProfile() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.deleteConversationProfile(request); - console.log(response); - } - - callDeleteConversationProfile(); - // [END dialogflow_v2beta1_generated_ConversationProfiles_DeleteConversationProfile_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.get_conversation_profile.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.get_conversation_profile.js deleted file mode 100644 index d46d62ae134..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.get_conversation_profile.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2beta1_generated_ConversationProfiles_GetConversationProfile_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the conversation profile. - * Format: `projects//locations//conversationProfiles/`. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ConversationProfilesClient(); - - async function callGetConversationProfile() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getConversationProfile(request); - console.log(response); - } - - callGetConversationProfile(); - // [END dialogflow_v2beta1_generated_ConversationProfiles_GetConversationProfile_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.list_conversation_profiles.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.list_conversation_profiles.js deleted file mode 100644 index c61024a3c87..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.list_conversation_profiles.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_ConversationProfiles_ListConversationProfiles_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project to list all conversation profiles from. - * Format: `projects//locations/`. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return in a single page. By - * default 100 and at most 1000. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ConversationProfilesClient(); - - async function callListConversationProfiles() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listConversationProfilesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListConversationProfiles(); - // [END dialogflow_v2beta1_generated_ConversationProfiles_ListConversationProfiles_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.set_suggestion_feature_config.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.set_suggestion_feature_config.js deleted file mode 100644 index 5823e47f213..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.set_suggestion_feature_config.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2022 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'; - -function main(conversationProfile, participantRole, suggestionFeatureConfig) { - // [START dialogflow_v2beta1_generated_ConversationProfiles_SetSuggestionFeatureConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Conversation Profile to add or update the suggestion feature - * config. Format: `projects//locations//conversationProfiles/`. - */ - // const conversationProfile = 'abc123' - /** - * Required. The participant role to add or update the suggestion feature - * config. Only HUMAN_AGENT or END_USER can be used. - */ - // const participantRole = {} - /** - * Required. The suggestion feature config to add or update. - */ - // const suggestionFeatureConfig = {} - - // Imports the Dialogflow library - const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ConversationProfilesClient(); - - async function callSetSuggestionFeatureConfig() { - // Construct request - const request = { - conversationProfile, - participantRole, - suggestionFeatureConfig, - }; - - // Run request - const [operation] = await dialogflowClient.setSuggestionFeatureConfig(request); - const [response] = await operation.promise(); - console.log(response); - } - - callSetSuggestionFeatureConfig(); - // [END dialogflow_v2beta1_generated_ConversationProfiles_SetSuggestionFeatureConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.update_conversation_profile.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.update_conversation_profile.js deleted file mode 100644 index 78ea9ed9bda..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversation_profiles.update_conversation_profile.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2022 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'; - -function main(conversationProfile, updateMask) { - // [START dialogflow_v2beta1_generated_ConversationProfiles_UpdateConversationProfile_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The conversation profile to update. - */ - // const conversationProfile = {} - /** - * Required. The mask to control which fields to update. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ConversationProfilesClient(); - - async function callUpdateConversationProfile() { - // Construct request - const request = { - conversationProfile, - updateMask, - }; - - // Run request - const response = await dialogflowClient.updateConversationProfile(request); - console.log(response); - } - - callUpdateConversationProfile(); - // [END dialogflow_v2beta1_generated_ConversationProfiles_UpdateConversationProfile_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.batch_create_messages.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.batch_create_messages.js deleted file mode 100644 index 23afc4a719a..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.batch_create_messages.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, requests) { - // [START dialogflow_v2beta1_generated_Conversations_BatchCreateMessages_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource identifier of the conversation to create message. - * Format: `projects//locations//conversations/`. - */ - // const parent = 'abc123' - /** - * 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. - */ - // const requests = 1234 - - // Imports the Dialogflow library - const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ConversationsClient(); - - async function callBatchCreateMessages() { - // Construct request - const request = { - parent, - requests, - }; - - // Run request - const response = await dialogflowClient.batchCreateMessages(request); - console.log(response); - } - - callBatchCreateMessages(); - // [END dialogflow_v2beta1_generated_Conversations_BatchCreateMessages_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.complete_conversation.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.complete_conversation.js deleted file mode 100644 index a7af3e43013..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.complete_conversation.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2beta1_generated_Conversations_CompleteConversation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource identifier of the conversation to close. - * Format: `projects//locations//conversations/`. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ConversationsClient(); - - async function callCompleteConversation() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.completeConversation(request); - console.log(response); - } - - callCompleteConversation(); - // [END dialogflow_v2beta1_generated_Conversations_CompleteConversation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.create_conversation.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.create_conversation.js deleted file mode 100644 index c6f79f3c11f..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.create_conversation.js +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, conversation) { - // [START dialogflow_v2beta1_generated_Conversations_CreateConversation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource identifier of the project creating the conversation. - * Format: `projects//locations/`. - */ - // const parent = 'abc123' - /** - * Required. The conversation to create. - */ - // const conversation = {} - /** - * 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. - */ - // const conversationId = 'abc123' - - // Imports the Dialogflow library - const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ConversationsClient(); - - async function callCreateConversation() { - // Construct request - const request = { - parent, - conversation, - }; - - // Run request - const response = await dialogflowClient.createConversation(request); - console.log(response); - } - - callCreateConversation(); - // [END dialogflow_v2beta1_generated_Conversations_CreateConversation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.get_conversation.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.get_conversation.js deleted file mode 100644 index e408a83384a..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.get_conversation.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2beta1_generated_Conversations_GetConversation_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the conversation. Format: - * `projects//locations//conversations/`. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ConversationsClient(); - - async function callGetConversation() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getConversation(request); - console.log(response); - } - - callGetConversation(); - // [END dialogflow_v2beta1_generated_Conversations_GetConversation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.list_conversations.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.list_conversations.js deleted file mode 100644 index 81e76c97e9c..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.list_conversations.js +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_Conversations_ListConversations_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project from which to list all conversation. - * Format: `projects//locations/`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - /** - * 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). - */ - // const filter = 'abc123' - - // Imports the Dialogflow library - const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ConversationsClient(); - - async function callListConversations() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listConversationsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListConversations(); - // [END dialogflow_v2beta1_generated_Conversations_ListConversations_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.list_messages.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.list_messages.js deleted file mode 100644 index 239e3bff07c..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.list_messages.js +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_Conversations_ListMessages_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the conversation to list messages for. - * Format: `projects//locations//conversations/` - */ - // const parent = 'abc123' - /** - * 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). - */ - // const filter = 'abc123' - /** - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ConversationsClient(); - - async function callListMessages() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listMessagesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListMessages(); - // [END dialogflow_v2beta1_generated_Conversations_ListMessages_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.suggest_conversation_summary.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.suggest_conversation_summary.js deleted file mode 100644 index 18d9ac2df60..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/conversations.suggest_conversation_summary.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2022 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'; - -function main(conversation) { - // [START dialogflow_v2beta1_generated_Conversations_SuggestConversationSummary_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The conversation to fetch suggestion for. - * Format: `projects//locations//conversations/`. - */ - // const conversation = 'abc123' - /** - * The name of the latest conversation message used as context for - * compiling suggestion. If empty, the latest message of the conversation will - * be used. - * Format: `projects//locations//conversations//messages/`. - */ - // const latestMessage = 'abc123' - /** - * Max number of messages prior to and including - * latest_message to use as context when compiling the - * suggestion. By default 500 and at most 1000. - */ - // const contextSize = 1234 - - // Imports the Dialogflow library - const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ConversationsClient(); - - async function callSuggestConversationSummary() { - // Construct request - const request = { - conversation, - }; - - // Run request - const response = await dialogflowClient.suggestConversationSummary(request); - console.log(response); - } - - callSuggestConversationSummary(); - // [END dialogflow_v2beta1_generated_Conversations_SuggestConversationSummary_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.create_document.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.create_document.js deleted file mode 100644 index d552bdb3c21..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.create_document.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, document) { - // [START dialogflow_v2beta1_generated_Documents_CreateDocument_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The knowledge base to create a document for. - * Format: `projects//locations//knowledgeBases/`. - */ - // const parent = 'abc123' - /** - * Required. The document to create. - */ - // const document = {} - /** - * Whether to import custom metadata from Google Cloud Storage. - * Only valid when the document source is Google Cloud Storage URI. - */ - // const importGcsCustomMetadata = true - - // Imports the Dialogflow library - const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new DocumentsClient(); - - async function callCreateDocument() { - // Construct request - const request = { - parent, - document, - }; - - // Run request - const [operation] = await dialogflowClient.createDocument(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateDocument(); - // [END dialogflow_v2beta1_generated_Documents_CreateDocument_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.delete_document.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.delete_document.js deleted file mode 100644 index db20422b45e..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.delete_document.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2beta1_generated_Documents_DeleteDocument_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the document to delete. - * Format: `projects//locations//knowledgeBases//documents/`. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new DocumentsClient(); - - async function callDeleteDocument() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await dialogflowClient.deleteDocument(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteDocument(); - // [END dialogflow_v2beta1_generated_Documents_DeleteDocument_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.get_document.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.get_document.js deleted file mode 100644 index 2388357475b..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.get_document.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2beta1_generated_Documents_GetDocument_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the document to retrieve. - * Format `projects//locations//knowledgeBases//documents/`. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new DocumentsClient(); - - async function callGetDocument() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getDocument(request); - console.log(response); - } - - callGetDocument(); - // [END dialogflow_v2beta1_generated_Documents_GetDocument_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.import_documents.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.import_documents.js deleted file mode 100644 index 3f6bf3e843a..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.import_documents.js +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, documentTemplate) { - // [START dialogflow_v2beta1_generated_Documents_ImportDocuments_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The knowledge base to import documents into. - * Format: `projects//locations//knowledgeBases/`. - */ - // const parent = 'abc123' - /** - * The Google Cloud Storage location for the documents. - * The path can include a wildcard. - * These URIs may have the forms - * `gs:///`. - * `gs:////*.`. - */ - // const gcsSource = {} - /** - * Required. Document template used for importing all the documents. - */ - // const documentTemplate = {} - /** - * Whether to import custom metadata from Google Cloud Storage. - * Only valid when the document source is Google Cloud Storage URI. - */ - // const importGcsCustomMetadata = true - - // Imports the Dialogflow library - const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new DocumentsClient(); - - async function callImportDocuments() { - // Construct request - const request = { - parent, - documentTemplate, - }; - - // Run request - const [operation] = await dialogflowClient.importDocuments(request); - const [response] = await operation.promise(); - console.log(response); - } - - callImportDocuments(); - // [END dialogflow_v2beta1_generated_Documents_ImportDocuments_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.list_documents.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.list_documents.js deleted file mode 100644 index af65dd941f5..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.list_documents.js +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_Documents_ListDocuments_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The knowledge base to list all documents for. - * Format: `projects//locations//knowledgeBases/`. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return in a single page. By - * default 10 and at most 100. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - /** - * 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). - */ - // const filter = 'abc123' - - // Imports the Dialogflow library - const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new DocumentsClient(); - - async function callListDocuments() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listDocumentsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListDocuments(); - // [END dialogflow_v2beta1_generated_Documents_ListDocuments_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.reload_document.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.reload_document.js deleted file mode 100644 index f1e5778505f..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.reload_document.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2beta1_generated_Documents_ReloadDocument_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the document to reload. - * Format: `projects//locations//knowledgeBases//documents/` - */ - // const name = 'abc123' - /** - * The path for a Cloud Storage source file for reloading document content. - * If not provided, the Document's existing source will be reloaded. - */ - // const gcsSource = {} - /** - * Whether to import custom metadata from Google Cloud Storage. - * Only valid when the document source is Google Cloud Storage URI. - */ - // const importGcsCustomMetadata = true - - // Imports the Dialogflow library - const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new DocumentsClient(); - - async function callReloadDocument() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await dialogflowClient.reloadDocument(request); - const [response] = await operation.promise(); - console.log(response); - } - - callReloadDocument(); - // [END dialogflow_v2beta1_generated_Documents_ReloadDocument_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.update_document.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.update_document.js deleted file mode 100644 index e46ab841b5a..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/documents.update_document.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2022 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'; - -function main(document) { - // [START dialogflow_v2beta1_generated_Documents_UpdateDocument_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The document to update. - */ - // const document = {} - /** - * Optional. Not specified means `update all`. - * Currently, only `display_name` can be updated, an InvalidArgument will be - * returned for attempting to update other fields. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new DocumentsClient(); - - async function callUpdateDocument() { - // Construct request - const request = { - document, - }; - - // Run request - const [operation] = await dialogflowClient.updateDocument(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateDocument(); - // [END dialogflow_v2beta1_generated_Documents_UpdateDocument_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_create_entities.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_create_entities.js deleted file mode 100644 index db4da1cc2c9..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_create_entities.js +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, entities) { - // [START dialogflow_v2beta1_generated_EntityTypes_BatchCreateEntities_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the entity type to create entities in. - * Supported formats: - * - `projects//agent/entityTypes/` - * - `projects//locations//agent/entityTypes/` - */ - // const parent = 'abc123' - /** - * Required. The entities to create. - */ - // const entities = 1234 - /** - * 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). - */ - // const languageCode = 'abc123' - - // Imports the Dialogflow library - const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new EntityTypesClient(); - - async function callBatchCreateEntities() { - // Construct request - const request = { - parent, - entities, - }; - - // Run request - const [operation] = await dialogflowClient.batchCreateEntities(request); - const [response] = await operation.promise(); - console.log(response); - } - - callBatchCreateEntities(); - // [END dialogflow_v2beta1_generated_EntityTypes_BatchCreateEntities_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_delete_entities.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_delete_entities.js deleted file mode 100644 index ac62a1ce5c2..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_delete_entities.js +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, entityValues) { - // [START dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntities_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the entity type to delete entries for. - * Supported formats: - * - `projects//agent/entityTypes/` - * - `projects//locations//agent/entityTypes/` - */ - // const parent = 'abc123' - /** - * 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/`. - */ - // const entityValues = 'abc123' - /** - * 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). - */ - // const languageCode = 'abc123' - - // Imports the Dialogflow library - const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new EntityTypesClient(); - - async function callBatchDeleteEntities() { - // Construct request - const request = { - parent, - entityValues, - }; - - // Run request - const [operation] = await dialogflowClient.batchDeleteEntities(request); - const [response] = await operation.promise(); - console.log(response); - } - - callBatchDeleteEntities(); - // [END dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntities_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_delete_entity_types.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_delete_entity_types.js deleted file mode 100644 index caabef66668..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_delete_entity_types.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, entityTypeNames) { - // [START dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntityTypes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the agent to delete all entities types for. - * Supported formats: - * - `projects//agent`, - * - `projects//locations//agent`. - */ - // const parent = 'abc123' - /** - * Required. The names entity types to delete. All names must point to the - * same agent as `parent`. - */ - // const entityTypeNames = 'abc123' - - // Imports the Dialogflow library - const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new EntityTypesClient(); - - async function callBatchDeleteEntityTypes() { - // Construct request - const request = { - parent, - entityTypeNames, - }; - - // Run request - const [operation] = await dialogflowClient.batchDeleteEntityTypes(request); - const [response] = await operation.promise(); - console.log(response); - } - - callBatchDeleteEntityTypes(); - // [END dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntityTypes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_update_entities.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_update_entities.js deleted file mode 100644 index 4a4c08803b3..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_update_entities.js +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, entities) { - // [START dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntities_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the entity type to update or create entities in. - * Supported formats: - * - `projects//agent/entityTypes/` - * - `projects//locations//agent/entityTypes/` - */ - // const parent = 'abc123' - /** - * Required. The entities to update or create. - */ - // const entities = 1234 - /** - * 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). - */ - // const languageCode = 'abc123' - /** - * Optional. The mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new EntityTypesClient(); - - async function callBatchUpdateEntities() { - // Construct request - const request = { - parent, - entities, - }; - - // Run request - const [operation] = await dialogflowClient.batchUpdateEntities(request); - const [response] = await operation.promise(); - console.log(response); - } - - callBatchUpdateEntities(); - // [END dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntities_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_update_entity_types.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_update_entity_types.js deleted file mode 100644 index 0ac513a6d9a..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.batch_update_entity_types.js +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntityTypes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the agent to update or create entity types in. - * Supported formats: - * - `projects//agent` - * - `projects//locations//agent` - */ - // const parent = 'abc123' - /** - * 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://". - */ - // const entityTypeBatchUri = 'abc123' - /** - * The collection of entity types to update or create. - */ - // const entityTypeBatchInline = {} - /** - * 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). - */ - // const languageCode = 'abc123' - /** - * Optional. The mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new EntityTypesClient(); - - async function callBatchUpdateEntityTypes() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await dialogflowClient.batchUpdateEntityTypes(request); - const [response] = await operation.promise(); - console.log(response); - } - - callBatchUpdateEntityTypes(); - // [END dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntityTypes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.create_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.create_entity_type.js deleted file mode 100644 index 97aba8a357c..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.create_entity_type.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, entityType) { - // [START dialogflow_v2beta1_generated_EntityTypes_CreateEntityType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The agent to create a entity type for. - * Supported formats: - * - `projects//agent` - * - `projects//locations//agent` - */ - // const parent = 'abc123' - /** - * Required. The entity type to create. - */ - // const 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). - */ - // const languageCode = 'abc123' - - // Imports the Dialogflow library - const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new EntityTypesClient(); - - async function callCreateEntityType() { - // Construct request - const request = { - parent, - entityType, - }; - - // Run request - const response = await dialogflowClient.createEntityType(request); - console.log(response); - } - - callCreateEntityType(); - // [END dialogflow_v2beta1_generated_EntityTypes_CreateEntityType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.delete_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.delete_entity_type.js deleted file mode 100644 index 2bb6ad5c66c..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.delete_entity_type.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2beta1_generated_EntityTypes_DeleteEntityType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the entity type to delete. - * Supported formats: - * - `projects//agent/entityTypes/` - * - `projects//locations//agent/entityTypes/` - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new EntityTypesClient(); - - async function callDeleteEntityType() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.deleteEntityType(request); - console.log(response); - } - - callDeleteEntityType(); - // [END dialogflow_v2beta1_generated_EntityTypes_DeleteEntityType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.get_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.get_entity_type.js deleted file mode 100644 index fd0b856a2e1..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.get_entity_type.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2beta1_generated_EntityTypes_GetEntityType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the entity type. - * Supported formats: - * - `projects//agent/entityTypes/` - * - `projects//locations//agent/entityTypes/` - */ - // const name = 'abc123' - /** - * 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). - */ - // const languageCode = 'abc123' - - // Imports the Dialogflow library - const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new EntityTypesClient(); - - async function callGetEntityType() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getEntityType(request); - console.log(response); - } - - callGetEntityType(); - // [END dialogflow_v2beta1_generated_EntityTypes_GetEntityType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.list_entity_types.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.list_entity_types.js deleted file mode 100644 index a2276da5bbc..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.list_entity_types.js +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_EntityTypes_ListEntityTypes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The agent to list all entity types from. - * Supported formats: - * - `projects//agent` - * - `projects//locations//agent` - */ - // const parent = 'abc123' - /** - * 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). - */ - // const languageCode = 'abc123' - /** - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new EntityTypesClient(); - - async function callListEntityTypes() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listEntityTypesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListEntityTypes(); - // [END dialogflow_v2beta1_generated_EntityTypes_ListEntityTypes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.update_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.update_entity_type.js deleted file mode 100644 index aa87205c946..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/entity_types.update_entity_type.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 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'; - -function main(entityType) { - // [START dialogflow_v2beta1_generated_EntityTypes_UpdateEntityType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The entity type to update. - */ - // const 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). - */ - // const languageCode = 'abc123' - /** - * Optional. The mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new EntityTypesClient(); - - async function callUpdateEntityType() { - // Construct request - const request = { - entityType, - }; - - // Run request - const response = await dialogflowClient.updateEntityType(request); - console.log(response); - } - - callUpdateEntityType(); - // [END dialogflow_v2beta1_generated_EntityTypes_UpdateEntityType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.create_environment.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.create_environment.js deleted file mode 100644 index d1ac1e20e7c..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.create_environment.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, environment, environmentId) { - // [START dialogflow_v2beta1_generated_Environments_CreateEnvironment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The agent to create an environment for. - * Supported formats: - * - `projects//agent` - * - `projects//locations//agent` - */ - // const parent = 'abc123' - /** - * Required. The environment to create. - */ - // const environment = {} - /** - * Required. The unique id of the new environment. - */ - // const environmentId = 'abc123' - - // Imports the Dialogflow library - const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new EnvironmentsClient(); - - async function callCreateEnvironment() { - // Construct request - const request = { - parent, - environment, - environmentId, - }; - - // Run request - const response = await dialogflowClient.createEnvironment(request); - console.log(response); - } - - callCreateEnvironment(); - // [END dialogflow_v2beta1_generated_Environments_CreateEnvironment_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.delete_environment.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.delete_environment.js deleted file mode 100644 index 03704937bf8..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.delete_environment.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2beta1_generated_Environments_DeleteEnvironment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the environment to delete. - * / Format: - * - `projects//agent/environments/` - * - `projects//locations//agent/environments/` - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new EnvironmentsClient(); - - async function callDeleteEnvironment() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.deleteEnvironment(request); - console.log(response); - } - - callDeleteEnvironment(); - // [END dialogflow_v2beta1_generated_Environments_DeleteEnvironment_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.get_environment.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.get_environment.js deleted file mode 100644 index 086269c194d..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.get_environment.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2beta1_generated_Environments_GetEnvironment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the environment. - * Supported formats: - * - `projects//agent/environments/` - * - `projects//locations//agent/environments/` - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new EnvironmentsClient(); - - async function callGetEnvironment() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getEnvironment(request); - console.log(response); - } - - callGetEnvironment(); - // [END dialogflow_v2beta1_generated_Environments_GetEnvironment_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.get_environment_history.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.get_environment_history.js deleted file mode 100644 index 0fe14234de6..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.get_environment_history.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_Environments_GetEnvironmentHistory_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the environment to retrieve history for. - * Supported formats: - * - `projects//agent/environments/` - * - `projects//locations//agent/environments/` - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of items to return in a single page. By default 100 and - * at most 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new EnvironmentsClient(); - - async function callGetEnvironmentHistory() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.getEnvironmentHistoryAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callGetEnvironmentHistory(); - // [END dialogflow_v2beta1_generated_Environments_GetEnvironmentHistory_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.list_environments.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.list_environments.js deleted file mode 100644 index b13bb94f6b6..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.list_environments.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_Environments_ListEnvironments_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The agent to list all environments from. - * Format: - * - `projects//agent` - * - `projects//locations//agent` - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of items to return in a single page. By default 100 and - * at most 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new EnvironmentsClient(); - - async function callListEnvironments() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listEnvironmentsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListEnvironments(); - // [END dialogflow_v2beta1_generated_Environments_ListEnvironments_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.update_environment.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.update_environment.js deleted file mode 100644 index 1c30a30ef3d..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/environments.update_environment.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 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'; - -function main(environment, updateMask) { - // [START dialogflow_v2beta1_generated_Environments_UpdateEnvironment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The environment to update. - */ - // const environment = {} - /** - * Required. The mask to control which fields get updated. - */ - // const updateMask = {} - /** - * 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 = `-`). - */ - // const allowLoadToDraftAndDiscardChanges = true - - // Imports the Dialogflow library - const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new EnvironmentsClient(); - - async function callUpdateEnvironment() { - // Construct request - const request = { - environment, - updateMask, - }; - - // Run request - const response = await dialogflowClient.updateEnvironment(request); - console.log(response); - } - - callUpdateEnvironment(); - // [END dialogflow_v2beta1_generated_Environments_UpdateEnvironment_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/fulfillments.get_fulfillment.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/fulfillments.get_fulfillment.js deleted file mode 100644 index 91cb58b2b60..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/fulfillments.get_fulfillment.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2beta1_generated_Fulfillments_GetFulfillment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the fulfillment. - * Supported formats: - * - `projects//agent/fulfillment` - * - `projects//locations//agent/fulfillment` - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {FulfillmentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new FulfillmentsClient(); - - async function callGetFulfillment() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getFulfillment(request); - console.log(response); - } - - callGetFulfillment(); - // [END dialogflow_v2beta1_generated_Fulfillments_GetFulfillment_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/fulfillments.update_fulfillment.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/fulfillments.update_fulfillment.js deleted file mode 100644 index bb043db9083..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/fulfillments.update_fulfillment.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 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'; - -function main(fulfillment, updateMask) { - // [START dialogflow_v2beta1_generated_Fulfillments_UpdateFulfillment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The fulfillment to update. - */ - // const fulfillment = {} - /** - * Required. The mask to control which fields get updated. If the mask is not - * present, all fields will be updated. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {FulfillmentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new FulfillmentsClient(); - - async function callUpdateFulfillment() { - // Construct request - const request = { - fulfillment, - updateMask, - }; - - // Run request - const response = await dialogflowClient.updateFulfillment(request); - console.log(response); - } - - callUpdateFulfillment(); - // [END dialogflow_v2beta1_generated_Fulfillments_UpdateFulfillment_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.batch_delete_intents.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.batch_delete_intents.js deleted file mode 100644 index 6aaec0ced80..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.batch_delete_intents.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, intents) { - // [START dialogflow_v2beta1_generated_Intents_BatchDeleteIntents_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the agent to delete all entities types for. - * Supported formats: - * - `projects//agent` - * - `projects//locations//agent` - */ - // const parent = 'abc123' - /** - * Required. The collection of intents to delete. Only intent `name` must be - * filled in. - */ - // const intents = 1234 - - // Imports the Dialogflow library - const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new IntentsClient(); - - async function callBatchDeleteIntents() { - // Construct request - const request = { - parent, - intents, - }; - - // Run request - const [operation] = await dialogflowClient.batchDeleteIntents(request); - const [response] = await operation.promise(); - console.log(response); - } - - callBatchDeleteIntents(); - // [END dialogflow_v2beta1_generated_Intents_BatchDeleteIntents_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.batch_update_intents.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.batch_update_intents.js deleted file mode 100644 index e2b9ec8b262..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.batch_update_intents.js +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_Intents_BatchUpdateIntents_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the agent to update or create intents in. - * Supported formats: - * - `projects//agent` - * - `projects//locations//agent` - */ - // const parent = 'abc123' - /** - * 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://". - */ - // const intentBatchUri = 'abc123' - /** - * The collection of intents to update or create. - */ - // const intentBatchInline = {} - /** - * 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). - */ - // const languageCode = 'abc123' - /** - * Optional. The mask to control which fields get updated. - */ - // const updateMask = {} - /** - * Optional. The resource view to apply to the returned intent. - */ - // const intentView = {} - - // Imports the Dialogflow library - const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new IntentsClient(); - - async function callBatchUpdateIntents() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await dialogflowClient.batchUpdateIntents(request); - const [response] = await operation.promise(); - console.log(response); - } - - callBatchUpdateIntents(); - // [END dialogflow_v2beta1_generated_Intents_BatchUpdateIntents_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.create_intent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.create_intent.js deleted file mode 100644 index 1bdb28a223c..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.create_intent.js +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, intent) { - // [START dialogflow_v2beta1_generated_Intents_CreateIntent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The agent to create a intent for. - * Supported formats: - * - `projects//agent` - * - `projects//locations//agent` - */ - // const parent = 'abc123' - /** - * Required. The intent to create. - */ - // const 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). - */ - // const languageCode = 'abc123' - /** - * Optional. The resource view to apply to the returned intent. - */ - // const intentView = {} - - // Imports the Dialogflow library - const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new IntentsClient(); - - async function callCreateIntent() { - // Construct request - const request = { - parent, - intent, - }; - - // Run request - const response = await dialogflowClient.createIntent(request); - console.log(response); - } - - callCreateIntent(); - // [END dialogflow_v2beta1_generated_Intents_CreateIntent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.delete_intent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.delete_intent.js deleted file mode 100644 index 64b530cd709..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.delete_intent.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2beta1_generated_Intents_DeleteIntent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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/` - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new IntentsClient(); - - async function callDeleteIntent() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.deleteIntent(request); - console.log(response); - } - - callDeleteIntent(); - // [END dialogflow_v2beta1_generated_Intents_DeleteIntent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.get_intent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.get_intent.js deleted file mode 100644 index 3f00eb8f302..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.get_intent.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2beta1_generated_Intents_GetIntent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the intent. - * Supported formats: - * - `projects//agent/intents/` - * - `projects//locations//agent/intents/` - */ - // const name = 'abc123' - /** - * 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). - */ - // const languageCode = 'abc123' - /** - * Optional. The resource view to apply to the returned intent. - */ - // const intentView = {} - - // Imports the Dialogflow library - const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new IntentsClient(); - - async function callGetIntent() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getIntent(request); - console.log(response); - } - - callGetIntent(); - // [END dialogflow_v2beta1_generated_Intents_GetIntent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.list_intents.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.list_intents.js deleted file mode 100644 index 529499a739f..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.list_intents.js +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_Intents_ListIntents_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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. - */ - // const parent = 'abc123' - /** - * 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). - */ - // const languageCode = 'abc123' - /** - * Optional. The resource view to apply to the returned intent. - */ - // const intentView = {} - /** - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new IntentsClient(); - - async function callListIntents() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listIntentsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListIntents(); - // [END dialogflow_v2beta1_generated_Intents_ListIntents_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.update_intent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.update_intent.js deleted file mode 100644 index ee7c7bc9005..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/intents.update_intent.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2022 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'; - -function main(intent) { - // [START dialogflow_v2beta1_generated_Intents_UpdateIntent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The intent to update. - */ - // const 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). - */ - // const languageCode = 'abc123' - /** - * Optional. The mask to control which fields get updated. - */ - // const updateMask = {} - /** - * Optional. The resource view to apply to the returned intent. - */ - // const intentView = {} - - // Imports the Dialogflow library - const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new IntentsClient(); - - async function callUpdateIntent() { - // Construct request - const request = { - intent, - }; - - // Run request - const response = await dialogflowClient.updateIntent(request); - console.log(response); - } - - callUpdateIntent(); - // [END dialogflow_v2beta1_generated_Intents_UpdateIntent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.create_knowledge_base.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.create_knowledge_base.js deleted file mode 100644 index e94541196c3..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.create_knowledge_base.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, knowledgeBase) { - // [START dialogflow_v2beta1_generated_KnowledgeBases_CreateKnowledgeBase_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project to create a knowledge base for. - * Format: `projects//locations/`. - */ - // const parent = 'abc123' - /** - * Required. The knowledge base to create. - */ - // const knowledgeBase = {} - - // Imports the Dialogflow library - const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new KnowledgeBasesClient(); - - async function callCreateKnowledgeBase() { - // Construct request - const request = { - parent, - knowledgeBase, - }; - - // Run request - const response = await dialogflowClient.createKnowledgeBase(request); - console.log(response); - } - - callCreateKnowledgeBase(); - // [END dialogflow_v2beta1_generated_KnowledgeBases_CreateKnowledgeBase_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.delete_knowledge_base.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.delete_knowledge_base.js deleted file mode 100644 index c04b4806ab0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.delete_knowledge_base.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2beta1_generated_KnowledgeBases_DeleteKnowledgeBase_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the knowledge base to delete. - * Format: `projects//locations//knowledgeBases/`. - */ - // const name = 'abc123' - /** - * Optional. Force deletes the knowledge base. When set to true, any documents - * in the knowledge base are also deleted. - */ - // const force = true - - // Imports the Dialogflow library - const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new KnowledgeBasesClient(); - - async function callDeleteKnowledgeBase() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.deleteKnowledgeBase(request); - console.log(response); - } - - callDeleteKnowledgeBase(); - // [END dialogflow_v2beta1_generated_KnowledgeBases_DeleteKnowledgeBase_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.get_knowledge_base.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.get_knowledge_base.js deleted file mode 100644 index e87bfd0db99..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.get_knowledge_base.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2beta1_generated_KnowledgeBases_GetKnowledgeBase_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the knowledge base to retrieve. - * Format `projects//locations//knowledgeBases/`. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new KnowledgeBasesClient(); - - async function callGetKnowledgeBase() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getKnowledgeBase(request); - console.log(response); - } - - callGetKnowledgeBase(); - // [END dialogflow_v2beta1_generated_KnowledgeBases_GetKnowledgeBase_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.list_knowledge_bases.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.list_knowledge_bases.js deleted file mode 100644 index 714cd8fa804..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.list_knowledge_bases.js +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_KnowledgeBases_ListKnowledgeBases_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project to list of knowledge bases for. - * Format: `projects//locations/`. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return in a single page. By - * default 10 and at most 100. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - /** - * 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). - */ - // const filter = 'abc123' - - // Imports the Dialogflow library - const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new KnowledgeBasesClient(); - - async function callListKnowledgeBases() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listKnowledgeBasesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListKnowledgeBases(); - // [END dialogflow_v2beta1_generated_KnowledgeBases_ListKnowledgeBases_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.update_knowledge_base.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.update_knowledge_base.js deleted file mode 100644 index 6d7dad33ee9..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/knowledge_bases.update_knowledge_base.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 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'; - -function main(knowledgeBase) { - // [START dialogflow_v2beta1_generated_KnowledgeBases_UpdateKnowledgeBase_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The knowledge base to update. - */ - // const knowledgeBase = {} - /** - * Optional. Not specified means `update all`. - * Currently, only `display_name` can be updated, an InvalidArgument will be - * returned for attempting to update other fields. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new KnowledgeBasesClient(); - - async function callUpdateKnowledgeBase() { - // Construct request - const request = { - knowledgeBase, - }; - - // Run request - const response = await dialogflowClient.updateKnowledgeBase(request); - console.log(response); - } - - callUpdateKnowledgeBase(); - // [END dialogflow_v2beta1_generated_KnowledgeBases_UpdateKnowledgeBase_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.analyze_content.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.analyze_content.js deleted file mode 100644 index f5dac9c24e8..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.analyze_content.js +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright 2022 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'; - -function main(participant) { - // [START dialogflow_v2beta1_generated_Participants_AnalyzeContent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the participant this text comes from. - * Format: `projects//locations//conversations//participants/`. - */ - // const participant = 'abc123' - /** - * The natural language text to be processed. - */ - // const textInput = {} - /** - * The natural language speech audio to be processed. - */ - // const audioInput = {} - /** - * An input event to send to Dialogflow. - */ - // const eventInput = {} - /** - * 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. - */ - // const replyAudioConfig = {} - /** - * Parameters for a Dialogflow virtual-agent query. - */ - // const queryParams = {} - /** - * Parameters for a human assist query. - */ - // const assistQueryParams = {} - /** - * Additional parameters to be put into Dialogflow CX session parameters. To - * remove a parameter from the session, clients should explicitly set the - * parameter value to null. - * Note: this field should only be used if you are connecting to a Dialogflow - * CX agent. - */ - // const cxParameters = {} - /** - * The unique identifier of the CX page to override the `current_page` in the - * session. - * Format: `projects//locations//agents//flows//pages/`. - * If `cx_current_page` is specified, the previous state of the session will - * be ignored by Dialogflow CX, including the previous - * page QueryResult.current_page and the previous session - * parameters QueryResult.parameters. In most cases, `cx_current_page` and - * `cx_parameters` should be configured together to direct a session to a - * specific state. - * Note: this field should only be used if you are connecting to a Dialogflow - * CX agent. - */ - // const cxCurrentPage = 'abc123' - /** - * 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. - */ - // const messageSendTime = {} - /** - * 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. - */ - // const requestId = 'abc123' - - // Imports the Dialogflow library - const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ParticipantsClient(); - - async function callAnalyzeContent() { - // Construct request - const request = { - participant, - }; - - // Run request - const response = await dialogflowClient.analyzeContent(request); - console.log(response); - } - - callAnalyzeContent(); - // [END dialogflow_v2beta1_generated_Participants_AnalyzeContent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.compile_suggestion.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.compile_suggestion.js deleted file mode 100644 index 5001938dfad..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.compile_suggestion.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2022 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'; - -function main() { - // [START dialogflow_v2beta1_generated_Participants_CompileSuggestion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the participant to fetch suggestion for. - * Format: `projects//locations//conversations//participants/`. - */ - // const parent = 'abc123' - /** - * 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/`. - */ - // const latestMessage = 'abc123' - /** - * 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. - */ - // const contextSize = 1234 - - // Imports the Dialogflow library - const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ParticipantsClient(); - - async function callCompileSuggestion() { - // Construct request - const request = { - }; - - // Run request - const response = await dialogflowClient.compileSuggestion(request); - console.log(response); - } - - callCompileSuggestion(); - // [END dialogflow_v2beta1_generated_Participants_CompileSuggestion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.create_participant.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.create_participant.js deleted file mode 100644 index 59d6e263e47..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.create_participant.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, participant) { - // [START dialogflow_v2beta1_generated_Participants_CreateParticipant_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource identifier of the conversation adding the participant. - * Format: `projects//locations//conversations/`. - */ - // const parent = 'abc123' - /** - * Required. The participant to create. - */ - // const participant = {} - - // Imports the Dialogflow library - const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ParticipantsClient(); - - async function callCreateParticipant() { - // Construct request - const request = { - parent, - participant, - }; - - // Run request - const response = await dialogflowClient.createParticipant(request); - console.log(response); - } - - callCreateParticipant(); - // [END dialogflow_v2beta1_generated_Participants_CreateParticipant_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.get_participant.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.get_participant.js deleted file mode 100644 index 1ed6d03766f..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.get_participant.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2beta1_generated_Participants_GetParticipant_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the participant. Format: - * `projects//locations//conversations//participants/`. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ParticipantsClient(); - - async function callGetParticipant() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getParticipant(request); - console.log(response); - } - - callGetParticipant(); - // [END dialogflow_v2beta1_generated_Participants_GetParticipant_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.list_participants.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.list_participants.js deleted file mode 100644 index f7daa2cb3ef..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.list_participants.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_Participants_ListParticipants_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The conversation to list all participants from. - * Format: `projects//locations//conversations/`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ParticipantsClient(); - - async function callListParticipants() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listParticipantsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListParticipants(); - // [END dialogflow_v2beta1_generated_Participants_ListParticipants_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.list_suggestions.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.list_suggestions.js deleted file mode 100644 index 01be69c5f23..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.list_suggestions.js +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2022 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'; - -function main() { - // [START dialogflow_v2beta1_generated_Participants_ListSuggestions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the participant to fetch suggestions for. - * Format: `projects//locations//conversations//participants/`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of items to return in a single page. The - * default value is 100; the maximum value is 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - /** - * 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). - */ - // const filter = 'abc123' - - // Imports the Dialogflow library - const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ParticipantsClient(); - - async function callListSuggestions() { - // Construct request - const request = { - }; - - // Run request - const iterable = await dialogflowClient.listSuggestionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListSuggestions(); - // [END dialogflow_v2beta1_generated_Participants_ListSuggestions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.streaming_analyze_content.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.streaming_analyze_content.js deleted file mode 100644 index 885759143f3..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.streaming_analyze_content.js +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright 2022 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'; - -function main(participant) { - // [START dialogflow_v2beta1_generated_Participants_StreamingAnalyzeContent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the participant this text comes from. - * Format: `projects//locations//conversations//participants/`. - */ - // const participant = 'abc123' - /** - * Instructs the speech recognizer how to process the speech audio. - */ - // const audioConfig = {} - /** - * The natural language text to be processed. - */ - // const textConfig = {} - /** - * 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 - * StreamingAnalyzeContent. If this configuration is not supplied, speech - * synthesis is disabled. - */ - // const replyAudioConfig = {} - /** - * The input audio content to be recognized. Must be sent if `audio_config` - * is set in the first message. The complete audio over all streaming - * messages must not exceed 1 minute. - */ - // const inputAudio = 'Buffer.from('string')' - /** - * The UTF-8 encoded natural language text to be processed. Must be sent if - * `text_config` is set in the first message. Text length must not exceed - * 256 bytes for virtual agent interactions. The `input_text` field can be - * only sent once. - */ - // const inputText = 'abc123' - /** - * The DTMF digits used to invoke intent and fill in parameter value. - * This input is ignored if the previous response indicated that DTMF input - * is not accepted. - */ - // const inputDtmf = {} - /** - * Parameters for a Dialogflow virtual-agent query. - */ - // const queryParams = {} - /** - * Parameters for a human assist query. - */ - // const assistQueryParams = {} - /** - * Additional parameters to be put into Dialogflow CX session parameters. To - * remove a parameter from the session, clients should explicitly set the - * parameter value to null. - * Note: this field should only be used if you are connecting to a Dialogflow - * CX agent. - */ - // const cxParameters = {} - /** - * The unique identifier of the CX page to override the `current_page` in the - * session. - * Format: `projects//locations//agents//flows//pages/`. - * If `cx_current_page` is specified, the previous state of the session will - * be ignored by Dialogflow CX, including the previous - * page QueryResult.current_page and the previous session - * parameters QueryResult.parameters. In most cases, `cx_current_page` and - * `cx_parameters` should be configured together to direct a session to a - * specific state. - * Note: this field should only be used if you are connecting to a Dialogflow - * CX agent. - */ - // const cxCurrentPage = 'abc123' - /** - * Enable partial virtual agent responses. If this flag is not enabled, - * response stream still contains only one final response even if some - * `Fulfillment`s in Dialogflow virtual agent have been configured to return - * partial responses. - */ - // const enablePartialAutomatedAgentReply = true - - // Imports the Dialogflow library - const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ParticipantsClient(); - - async function callStreamingAnalyzeContent() { - // Construct request - const request = { - participant, - }; - - // Run request - const stream = await dialogflowClient.streamingAnalyzeContent(); - stream.on('data', (response) => { console.log(response) }); - stream.on('error', (err) => { throw(err) }); - stream.on('end', () => { /* API call completed */ }); - stream.write(request); - stream.end(); - } - - callStreamingAnalyzeContent(); - // [END dialogflow_v2beta1_generated_Participants_StreamingAnalyzeContent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.suggest_articles.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.suggest_articles.js deleted file mode 100644 index 038326b97be..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.suggest_articles.js +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_Participants_SuggestArticles_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the participant to fetch suggestion for. - * Format: `projects//locations//conversations//participants/`. - */ - // const parent = 'abc123' - /** - * 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/`. - */ - // const latestMessage = 'abc123' - /** - * 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. - */ - // const contextSize = 1234 - /** - * Optional. Parameters for a human assist query. - */ - // const assistQueryParams = {} - - // Imports the Dialogflow library - const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ParticipantsClient(); - - async function callSuggestArticles() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await dialogflowClient.suggestArticles(request); - console.log(response); - } - - callSuggestArticles(); - // [END dialogflow_v2beta1_generated_Participants_SuggestArticles_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.suggest_faq_answers.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.suggest_faq_answers.js deleted file mode 100644 index cebe5ce478a..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.suggest_faq_answers.js +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_Participants_SuggestFaqAnswers_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the participant to fetch suggestion for. - * Format: `projects//locations//conversations//participants/`. - */ - // const parent = 'abc123' - /** - * 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/`. - */ - // const latestMessage = 'abc123' - /** - * 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. - */ - // const contextSize = 1234 - /** - * Optional. Parameters for a human assist query. - */ - // const assistQueryParams = {} - - // Imports the Dialogflow library - const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ParticipantsClient(); - - async function callSuggestFaqAnswers() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await dialogflowClient.suggestFaqAnswers(request); - console.log(response); - } - - callSuggestFaqAnswers(); - // [END dialogflow_v2beta1_generated_Participants_SuggestFaqAnswers_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.suggest_smart_replies.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.suggest_smart_replies.js deleted file mode 100644 index 15a27996149..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.suggest_smart_replies.js +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_Participants_SuggestSmartReplies_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the participant to fetch suggestion for. - * Format: `projects//locations//conversations//participants/`. - */ - // const parent = 'abc123' - /** - * 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. - */ - // const currentTextInput = {} - /** - * 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/`. - */ - // const latestMessage = 'abc123' - /** - * 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. - */ - // const contextSize = 1234 - - // Imports the Dialogflow library - const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ParticipantsClient(); - - async function callSuggestSmartReplies() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await dialogflowClient.suggestSmartReplies(request); - console.log(response); - } - - callSuggestSmartReplies(); - // [END dialogflow_v2beta1_generated_Participants_SuggestSmartReplies_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.update_participant.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.update_participant.js deleted file mode 100644 index 214454f94f8..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/participants.update_participant.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2022 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'; - -function main(participant, updateMask) { - // [START dialogflow_v2beta1_generated_Participants_UpdateParticipant_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The participant to update. - */ - // const participant = {} - /** - * Required. The mask to specify which fields to update. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new ParticipantsClient(); - - async function callUpdateParticipant() { - // Construct request - const request = { - participant, - updateMask, - }; - - // Run request - const response = await dialogflowClient.updateParticipant(request); - console.log(response); - } - - callUpdateParticipant(); - // [END dialogflow_v2beta1_generated_Participants_UpdateParticipant_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.create_session_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.create_session_entity_type.js deleted file mode 100644 index 4ed022ae6d8..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.create_session_entity_type.js +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, sessionEntityType) { - // [START dialogflow_v2beta1_generated_SessionEntityTypes_CreateSessionEntityType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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. - */ - // const parent = 'abc123' - /** - * Required. The session entity type to create. - */ - // const sessionEntityType = {} - - // Imports the Dialogflow library - const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new SessionEntityTypesClient(); - - async function callCreateSessionEntityType() { - // Construct request - const request = { - parent, - sessionEntityType, - }; - - // Run request - const response = await dialogflowClient.createSessionEntityType(request); - console.log(response); - } - - callCreateSessionEntityType(); - // [END dialogflow_v2beta1_generated_SessionEntityTypes_CreateSessionEntityType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.delete_session_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.delete_session_entity_type.js deleted file mode 100644 index f99c287db0b..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.delete_session_entity_type.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2beta1_generated_SessionEntityTypes_DeleteSessionEntityType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new SessionEntityTypesClient(); - - async function callDeleteSessionEntityType() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.deleteSessionEntityType(request); - console.log(response); - } - - callDeleteSessionEntityType(); - // [END dialogflow_v2beta1_generated_SessionEntityTypes_DeleteSessionEntityType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.get_session_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.get_session_entity_type.js deleted file mode 100644 index a3aafbd9d94..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.get_session_entity_type.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2beta1_generated_SessionEntityTypes_GetSessionEntityType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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. - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new SessionEntityTypesClient(); - - async function callGetSessionEntityType() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getSessionEntityType(request); - console.log(response); - } - - callGetSessionEntityType(); - // [END dialogflow_v2beta1_generated_SessionEntityTypes_GetSessionEntityType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.list_session_entity_types.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.list_session_entity_types.js deleted file mode 100644 index 0a6afad6ea7..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.list_session_entity_types.js +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_SessionEntityTypes_ListSessionEntityTypes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of items to return in a single page. By - * default 100 and at most 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new SessionEntityTypesClient(); - - async function callListSessionEntityTypes() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listSessionEntityTypesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListSessionEntityTypes(); - // [END dialogflow_v2beta1_generated_SessionEntityTypes_ListSessionEntityTypes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.update_session_entity_type.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.update_session_entity_type.js deleted file mode 100644 index 04cb5585741..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/session_entity_types.update_session_entity_type.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 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'; - -function main(sessionEntityType) { - // [START dialogflow_v2beta1_generated_SessionEntityTypes_UpdateSessionEntityType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The session entity type to update. - */ - // const sessionEntityType = {} - /** - * Optional. The mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new SessionEntityTypesClient(); - - async function callUpdateSessionEntityType() { - // Construct request - const request = { - sessionEntityType, - }; - - // Run request - const response = await dialogflowClient.updateSessionEntityType(request); - console.log(response); - } - - callUpdateSessionEntityType(); - // [END dialogflow_v2beta1_generated_SessionEntityTypes_UpdateSessionEntityType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/sessions.detect_intent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/sessions.detect_intent.js deleted file mode 100644 index 9069bdd82f5..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/sessions.detect_intent.js +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright 2022 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'; - -function main(session, queryInput) { - // [START dialogflow_v2beta1_generated_Sessions_DetectIntent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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). - */ - // const session = 'abc123' - /** - * The parameters of this query. - */ - // const queryParams = {} - /** - * 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. - */ - // const queryInput = {} - /** - * 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. - */ - // const outputAudioConfig = {} - /** - * 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. - */ - // const outputAudioConfigMask = {} - /** - * 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. - */ - // const inputAudio = 'Buffer.from('string')' - - // Imports the Dialogflow library - const {SessionsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new SessionsClient(); - - async function callDetectIntent() { - // Construct request - const request = { - session, - queryInput, - }; - - // Run request - const response = await dialogflowClient.detectIntent(request); - console.log(response); - } - - callDetectIntent(); - // [END dialogflow_v2beta1_generated_Sessions_DetectIntent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/sessions.streaming_detect_intent.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/sessions.streaming_detect_intent.js deleted file mode 100644 index 52d75538ff7..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/sessions.streaming_detect_intent.js +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2022 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'; - -function main(session, queryInput) { - // [START dialogflow_v2beta1_generated_Sessions_StreamingDetectIntent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The 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). - */ - // const session = 'abc123' - /** - * The parameters of this query. - */ - // const queryParams = {} - /** - * 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. - */ - // const queryInput = {} - /** - * 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. - */ - // const singleUtterance = 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. - */ - // const outputAudioConfig = {} - /** - * 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. - */ - // const outputAudioConfigMask = {} - /** - * 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. - */ - // const inputAudio = 'Buffer.from('string')' - - // Imports the Dialogflow library - const {SessionsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new SessionsClient(); - - async function callStreamingDetectIntent() { - // Construct request - const request = { - session, - queryInput, - }; - - // Run request - const stream = await dialogflowClient.streamingDetectIntent(); - stream.on('data', (response) => { console.log(response) }); - stream.on('error', (err) => { throw(err) }); - stream.on('end', () => { /* API call completed */ }); - stream.write(request); - stream.end(); - } - - callStreamingDetectIntent(); - // [END dialogflow_v2beta1_generated_Sessions_StreamingDetectIntent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/snippet_metadata.google.cloud.dialogflow.v2beta1.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/snippet_metadata.google.cloud.dialogflow.v2beta1.json deleted file mode 100644 index f989adf3f04..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/snippet_metadata.google.cloud.dialogflow.v2beta1.json +++ /dev/null @@ -1,4327 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-dialogflow", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.dialogflow.v2beta1", - "version": "v2beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "dialogflow_v2beta1_generated_Agents_GetAgent_async", - "title": "dialogflow getAgent Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the specified agent.", - "canonical": true, - "file": "agents.get_agent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAgent", - "fullName": "google.cloud.dialogflow.v2beta1.Agents.GetAgent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.Agent", - "client": { - "shortName": "AgentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" - }, - "method": { - "shortName": "GetAgent", - "fullName": "google.cloud.dialogflow.v2beta1.Agents.GetAgent", - "service": { - "shortName": "Agents", - "fullName": "google.cloud.dialogflow.v2beta1.Agents" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Agents_SetAgent_async", - "title": "dialogflow setAgent Sample", - "origin": "API_DEFINITION", - "description": " 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).", - "canonical": true, - "file": "agents.set_agent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetAgent", - "fullName": "google.cloud.dialogflow.v2beta1.Agents.SetAgent", - "async": true, - "parameters": [ - { - "name": "agent", - "type": ".google.cloud.dialogflow.v2beta1.Agent" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.Agent", - "client": { - "shortName": "AgentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" - }, - "method": { - "shortName": "SetAgent", - "fullName": "google.cloud.dialogflow.v2beta1.Agents.SetAgent", - "service": { - "shortName": "Agents", - "fullName": "google.cloud.dialogflow.v2beta1.Agents" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Agents_DeleteAgent_async", - "title": "dialogflow deleteAgent Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified agent.", - "canonical": true, - "file": "agents.delete_agent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteAgent", - "fullName": "google.cloud.dialogflow.v2beta1.Agents.DeleteAgent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "AgentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" - }, - "method": { - "shortName": "DeleteAgent", - "fullName": "google.cloud.dialogflow.v2beta1.Agents.DeleteAgent", - "service": { - "shortName": "Agents", - "fullName": "google.cloud.dialogflow.v2beta1.Agents" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Agents_SearchAgents_async", - "title": "dialogflow searchAgents Sample", - "origin": "API_DEFINITION", - "description": " 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).", - "canonical": true, - "file": "agents.search_agents.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SearchAgents", - "fullName": "google.cloud.dialogflow.v2beta1.Agents.SearchAgents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.SearchAgentsResponse", - "client": { - "shortName": "AgentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" - }, - "method": { - "shortName": "SearchAgents", - "fullName": "google.cloud.dialogflow.v2beta1.Agents.SearchAgents", - "service": { - "shortName": "Agents", - "fullName": "google.cloud.dialogflow.v2beta1.Agents" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Agents_TrainAgent_async", - "title": "dialogflow trainAgent Sample", - "origin": "API_DEFINITION", - "description": " Trains the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", - "canonical": true, - "file": "agents.train_agent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TrainAgent", - "fullName": "google.cloud.dialogflow.v2beta1.Agents.TrainAgent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AgentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" - }, - "method": { - "shortName": "TrainAgent", - "fullName": "google.cloud.dialogflow.v2beta1.Agents.TrainAgent", - "service": { - "shortName": "Agents", - "fullName": "google.cloud.dialogflow.v2beta1.Agents" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Agents_ExportAgent_async", - "title": "dialogflow exportAgent Sample", - "origin": "API_DEFINITION", - "description": " Exports the specified agent to a ZIP file. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [ExportAgentResponse][google.cloud.dialogflow.v2beta1.ExportAgentResponse]", - "canonical": true, - "file": "agents.export_agent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ExportAgent", - "fullName": "google.cloud.dialogflow.v2beta1.Agents.ExportAgent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "agent_uri", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AgentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" - }, - "method": { - "shortName": "ExportAgent", - "fullName": "google.cloud.dialogflow.v2beta1.Agents.ExportAgent", - "service": { - "shortName": "Agents", - "fullName": "google.cloud.dialogflow.v2beta1.Agents" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Agents_ImportAgent_async", - "title": "dialogflow importAgent Sample", - "origin": "API_DEFINITION", - "description": " 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. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) The operation only tracks when importing is complete, 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).", - "canonical": true, - "file": "agents.import_agent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportAgent", - "fullName": "google.cloud.dialogflow.v2beta1.Agents.ImportAgent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "agent_uri", - "type": "TYPE_STRING" - }, - { - "name": "agent_content", - "type": "TYPE_BYTES" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AgentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" - }, - "method": { - "shortName": "ImportAgent", - "fullName": "google.cloud.dialogflow.v2beta1.Agents.ImportAgent", - "service": { - "shortName": "Agents", - "fullName": "google.cloud.dialogflow.v2beta1.Agents" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Agents_RestoreAgent_async", - "title": "dialogflow restoreAgent Sample", - "origin": "API_DEFINITION", - "description": " 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. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) The operation only tracks when restoring is complete, 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).", - "canonical": true, - "file": "agents.restore_agent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RestoreAgent", - "fullName": "google.cloud.dialogflow.v2beta1.Agents.RestoreAgent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "agent_uri", - "type": "TYPE_STRING" - }, - { - "name": "agent_content", - "type": "TYPE_BYTES" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AgentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" - }, - "method": { - "shortName": "RestoreAgent", - "fullName": "google.cloud.dialogflow.v2beta1.Agents.RestoreAgent", - "service": { - "shortName": "Agents", - "fullName": "google.cloud.dialogflow.v2beta1.Agents" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Agents_GetValidationResult_async", - "title": "dialogflow getValidationResult Sample", - "origin": "API_DEFINITION", - "description": " Gets agent validation result. Agent validation is performed during training time and is updated automatically when training is completed.", - "canonical": true, - "file": "agents.get_validation_result.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetValidationResult", - "fullName": "google.cloud.dialogflow.v2beta1.Agents.GetValidationResult", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.ValidationResult", - "client": { - "shortName": "AgentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" - }, - "method": { - "shortName": "GetValidationResult", - "fullName": "google.cloud.dialogflow.v2beta1.Agents.GetValidationResult", - "service": { - "shortName": "Agents", - "fullName": "google.cloud.dialogflow.v2beta1.Agents" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_AnswerRecords_GetAnswerRecord_async", - "title": "dialogflow getAnswerRecord Sample", - "origin": "API_DEFINITION", - "description": " Deprecated. Retrieves a specific answer record.", - "canonical": true, - "file": "answer_records.get_answer_record.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAnswerRecord", - "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords.GetAnswerRecord", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.AnswerRecord", - "client": { - "shortName": "AnswerRecordsClient", - "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecordsClient" - }, - "method": { - "shortName": "GetAnswerRecord", - "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords.GetAnswerRecord", - "service": { - "shortName": "AnswerRecords", - "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_AnswerRecords_ListAnswerRecords_async", - "title": "dialogflow listAnswerRecords Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of all answer records in the specified project in reverse chronological order.", - "canonical": true, - "file": "answer_records.list_answer_records.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAnswerRecords", - "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords.ListAnswerRecords", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse", - "client": { - "shortName": "AnswerRecordsClient", - "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecordsClient" - }, - "method": { - "shortName": "ListAnswerRecords", - "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords.ListAnswerRecords", - "service": { - "shortName": "AnswerRecords", - "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_AnswerRecords_UpdateAnswerRecord_async", - "title": "dialogflow updateAnswerRecord Sample", - "origin": "API_DEFINITION", - "description": " Updates the specified answer record.", - "canonical": true, - "file": "answer_records.update_answer_record.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateAnswerRecord", - "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords.UpdateAnswerRecord", - "async": true, - "parameters": [ - { - "name": "answer_record", - "type": ".google.cloud.dialogflow.v2beta1.AnswerRecord" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.AnswerRecord", - "client": { - "shortName": "AnswerRecordsClient", - "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecordsClient" - }, - "method": { - "shortName": "UpdateAnswerRecord", - "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords.UpdateAnswerRecord", - "service": { - "shortName": "AnswerRecords", - "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Contexts_ListContexts_async", - "title": "dialogflow listContexts Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of all contexts in the specified session.", - "canonical": true, - "file": "contexts.list_contexts.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListContexts", - "fullName": "google.cloud.dialogflow.v2beta1.Contexts.ListContexts", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.ListContextsResponse", - "client": { - "shortName": "ContextsClient", - "fullName": "google.cloud.dialogflow.v2beta1.ContextsClient" - }, - "method": { - "shortName": "ListContexts", - "fullName": "google.cloud.dialogflow.v2beta1.Contexts.ListContexts", - "service": { - "shortName": "Contexts", - "fullName": "google.cloud.dialogflow.v2beta1.Contexts" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Contexts_GetContext_async", - "title": "dialogflow getContext Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the specified context.", - "canonical": true, - "file": "contexts.get_context.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetContext", - "fullName": "google.cloud.dialogflow.v2beta1.Contexts.GetContext", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.Context", - "client": { - "shortName": "ContextsClient", - "fullName": "google.cloud.dialogflow.v2beta1.ContextsClient" - }, - "method": { - "shortName": "GetContext", - "fullName": "google.cloud.dialogflow.v2beta1.Contexts.GetContext", - "service": { - "shortName": "Contexts", - "fullName": "google.cloud.dialogflow.v2beta1.Contexts" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Contexts_CreateContext_async", - "title": "dialogflow createContext Sample", - "origin": "API_DEFINITION", - "description": " Creates a context. If the specified context already exists, overrides the context.", - "canonical": true, - "file": "contexts.create_context.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateContext", - "fullName": "google.cloud.dialogflow.v2beta1.Contexts.CreateContext", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "context", - "type": ".google.cloud.dialogflow.v2beta1.Context" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.Context", - "client": { - "shortName": "ContextsClient", - "fullName": "google.cloud.dialogflow.v2beta1.ContextsClient" - }, - "method": { - "shortName": "CreateContext", - "fullName": "google.cloud.dialogflow.v2beta1.Contexts.CreateContext", - "service": { - "shortName": "Contexts", - "fullName": "google.cloud.dialogflow.v2beta1.Contexts" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Contexts_UpdateContext_async", - "title": "dialogflow updateContext Sample", - "origin": "API_DEFINITION", - "description": " Updates the specified context.", - "canonical": true, - "file": "contexts.update_context.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateContext", - "fullName": "google.cloud.dialogflow.v2beta1.Contexts.UpdateContext", - "async": true, - "parameters": [ - { - "name": "context", - "type": ".google.cloud.dialogflow.v2beta1.Context" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.Context", - "client": { - "shortName": "ContextsClient", - "fullName": "google.cloud.dialogflow.v2beta1.ContextsClient" - }, - "method": { - "shortName": "UpdateContext", - "fullName": "google.cloud.dialogflow.v2beta1.Contexts.UpdateContext", - "service": { - "shortName": "Contexts", - "fullName": "google.cloud.dialogflow.v2beta1.Contexts" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Contexts_DeleteContext_async", - "title": "dialogflow deleteContext Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified context.", - "canonical": true, - "file": "contexts.delete_context.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteContext", - "fullName": "google.cloud.dialogflow.v2beta1.Contexts.DeleteContext", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ContextsClient", - "fullName": "google.cloud.dialogflow.v2beta1.ContextsClient" - }, - "method": { - "shortName": "DeleteContext", - "fullName": "google.cloud.dialogflow.v2beta1.Contexts.DeleteContext", - "service": { - "shortName": "Contexts", - "fullName": "google.cloud.dialogflow.v2beta1.Contexts" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Contexts_DeleteAllContexts_async", - "title": "dialogflow deleteAllContexts Sample", - "origin": "API_DEFINITION", - "description": " Deletes all active contexts in the specified session.", - "canonical": true, - "file": "contexts.delete_all_contexts.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteAllContexts", - "fullName": "google.cloud.dialogflow.v2beta1.Contexts.DeleteAllContexts", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ContextsClient", - "fullName": "google.cloud.dialogflow.v2beta1.ContextsClient" - }, - "method": { - "shortName": "DeleteAllContexts", - "fullName": "google.cloud.dialogflow.v2beta1.Contexts.DeleteAllContexts", - "service": { - "shortName": "Contexts", - "fullName": "google.cloud.dialogflow.v2beta1.Contexts" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_ConversationProfiles_ListConversationProfiles_async", - "title": "dialogflow listConversationProfiles Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of all conversation profiles in the specified project.", - "canonical": true, - "file": "conversation_profiles.list_conversation_profiles.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListConversationProfiles", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.ListConversationProfiles", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse", - "client": { - "shortName": "ConversationProfilesClient", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfilesClient" - }, - "method": { - "shortName": "ListConversationProfiles", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.ListConversationProfiles", - "service": { - "shortName": "ConversationProfiles", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_ConversationProfiles_GetConversationProfile_async", - "title": "dialogflow getConversationProfile Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the specified conversation profile.", - "canonical": true, - "file": "conversation_profiles.get_conversation_profile.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetConversationProfile", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfile", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.ConversationProfile", - "client": { - "shortName": "ConversationProfilesClient", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfilesClient" - }, - "method": { - "shortName": "GetConversationProfile", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfile", - "service": { - "shortName": "ConversationProfiles", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_ConversationProfiles_CreateConversationProfile_async", - "title": "dialogflow createConversationProfile Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "conversation_profiles.create_conversation_profile.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateConversationProfile", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.CreateConversationProfile", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "conversation_profile", - "type": ".google.cloud.dialogflow.v2beta1.ConversationProfile" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.ConversationProfile", - "client": { - "shortName": "ConversationProfilesClient", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfilesClient" - }, - "method": { - "shortName": "CreateConversationProfile", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.CreateConversationProfile", - "service": { - "shortName": "ConversationProfiles", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_ConversationProfiles_UpdateConversationProfile_async", - "title": "dialogflow updateConversationProfile Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "conversation_profiles.update_conversation_profile.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateConversationProfile", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.UpdateConversationProfile", - "async": true, - "parameters": [ - { - "name": "conversation_profile", - "type": ".google.cloud.dialogflow.v2beta1.ConversationProfile" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.ConversationProfile", - "client": { - "shortName": "ConversationProfilesClient", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfilesClient" - }, - "method": { - "shortName": "UpdateConversationProfile", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.UpdateConversationProfile", - "service": { - "shortName": "ConversationProfiles", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_ConversationProfiles_DeleteConversationProfile_async", - "title": "dialogflow deleteConversationProfile Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified conversation profile.", - "canonical": true, - "file": "conversation_profiles.delete_conversation_profile.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteConversationProfile", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.DeleteConversationProfile", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ConversationProfilesClient", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfilesClient" - }, - "method": { - "shortName": "DeleteConversationProfile", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.DeleteConversationProfile", - "service": { - "shortName": "ConversationProfiles", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_ConversationProfiles_SetSuggestionFeatureConfig_async", - "title": "dialogflow setSuggestionFeatureConfig Sample", - "origin": "API_DEFINITION", - "description": " Adds or updates a suggestion feature in a conversation profile. If the conversation profile contains the type of suggestion feature for the participant role, it will update it. Otherwise it will insert the suggestion feature. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [SetSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata] - `response`: [ConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfile] If a long running operation to add or update suggestion feature config for the same conversation profile, participant role and suggestion feature type exists, please cancel the existing long running operation before sending such request, otherwise the request will be rejected.", - "canonical": true, - "file": "conversation_profiles.set_suggestion_feature_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetSuggestionFeatureConfig", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.SetSuggestionFeatureConfig", - "async": true, - "parameters": [ - { - "name": "conversation_profile", - "type": "TYPE_STRING" - }, - { - "name": "participant_role", - "type": ".google.cloud.dialogflow.v2beta1.Participant.Role" - }, - { - "name": "suggestion_feature_config", - "type": ".google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ConversationProfilesClient", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfilesClient" - }, - "method": { - "shortName": "SetSuggestionFeatureConfig", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.SetSuggestionFeatureConfig", - "service": { - "shortName": "ConversationProfiles", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async", - "title": "dialogflow clearSuggestionFeatureConfig Sample", - "origin": "API_DEFINITION", - "description": " Clears a suggestion feature from a conversation profile for the given participant role. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [ClearSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata] - `response`: [ConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfile]", - "canonical": true, - "file": "conversation_profiles.clear_suggestion_feature_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ClearSuggestionFeatureConfig", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.ClearSuggestionFeatureConfig", - "async": true, - "parameters": [ - { - "name": "conversation_profile", - "type": "TYPE_STRING" - }, - { - "name": "participant_role", - "type": ".google.cloud.dialogflow.v2beta1.Participant.Role" - }, - { - "name": "suggestion_feature_type", - "type": ".google.cloud.dialogflow.v2beta1.SuggestionFeature.Type" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ConversationProfilesClient", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfilesClient" - }, - "method": { - "shortName": "ClearSuggestionFeatureConfig", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.ClearSuggestionFeatureConfig", - "service": { - "shortName": "ConversationProfiles", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Conversations_CreateConversation_async", - "title": "dialogflow createConversation Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "conversations.create_conversation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateConversation", - "fullName": "google.cloud.dialogflow.v2beta1.Conversations.CreateConversation", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "conversation", - "type": ".google.cloud.dialogflow.v2beta1.Conversation" - }, - { - "name": "conversation_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.Conversation", - "client": { - "shortName": "ConversationsClient", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationsClient" - }, - "method": { - "shortName": "CreateConversation", - "fullName": "google.cloud.dialogflow.v2beta1.Conversations.CreateConversation", - "service": { - "shortName": "Conversations", - "fullName": "google.cloud.dialogflow.v2beta1.Conversations" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Conversations_ListConversations_async", - "title": "dialogflow listConversations Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of all conversations in the specified project.", - "canonical": true, - "file": "conversations.list_conversations.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListConversations", - "fullName": "google.cloud.dialogflow.v2beta1.Conversations.ListConversations", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.ListConversationsResponse", - "client": { - "shortName": "ConversationsClient", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationsClient" - }, - "method": { - "shortName": "ListConversations", - "fullName": "google.cloud.dialogflow.v2beta1.Conversations.ListConversations", - "service": { - "shortName": "Conversations", - "fullName": "google.cloud.dialogflow.v2beta1.Conversations" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Conversations_GetConversation_async", - "title": "dialogflow getConversation Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the specific conversation.", - "canonical": true, - "file": "conversations.get_conversation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetConversation", - "fullName": "google.cloud.dialogflow.v2beta1.Conversations.GetConversation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.Conversation", - "client": { - "shortName": "ConversationsClient", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationsClient" - }, - "method": { - "shortName": "GetConversation", - "fullName": "google.cloud.dialogflow.v2beta1.Conversations.GetConversation", - "service": { - "shortName": "Conversations", - "fullName": "google.cloud.dialogflow.v2beta1.Conversations" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Conversations_CompleteConversation_async", - "title": "dialogflow completeConversation Sample", - "origin": "API_DEFINITION", - "description": " Completes the specified conversation. Finished conversations are purged from the database after 30 days.", - "canonical": true, - "file": "conversations.complete_conversation.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CompleteConversation", - "fullName": "google.cloud.dialogflow.v2beta1.Conversations.CompleteConversation", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.Conversation", - "client": { - "shortName": "ConversationsClient", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationsClient" - }, - "method": { - "shortName": "CompleteConversation", - "fullName": "google.cloud.dialogflow.v2beta1.Conversations.CompleteConversation", - "service": { - "shortName": "Conversations", - "fullName": "google.cloud.dialogflow.v2beta1.Conversations" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Conversations_BatchCreateMessages_async", - "title": "dialogflow batchCreateMessages Sample", - "origin": "API_DEFINITION", - "description": " Batch ingests messages to conversation. Customers can use this RPC to ingest historical messages to conversation.", - "canonical": true, - "file": "conversations.batch_create_messages.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchCreateMessages", - "fullName": "google.cloud.dialogflow.v2beta1.Conversations.BatchCreateMessages", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "requests", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse", - "client": { - "shortName": "ConversationsClient", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationsClient" - }, - "method": { - "shortName": "BatchCreateMessages", - "fullName": "google.cloud.dialogflow.v2beta1.Conversations.BatchCreateMessages", - "service": { - "shortName": "Conversations", - "fullName": "google.cloud.dialogflow.v2beta1.Conversations" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Conversations_ListMessages_async", - "title": "dialogflow listMessages Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "conversations.list_messages.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListMessages", - "fullName": "google.cloud.dialogflow.v2beta1.Conversations.ListMessages", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.ListMessagesResponse", - "client": { - "shortName": "ConversationsClient", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationsClient" - }, - "method": { - "shortName": "ListMessages", - "fullName": "google.cloud.dialogflow.v2beta1.Conversations.ListMessages", - "service": { - "shortName": "Conversations", - "fullName": "google.cloud.dialogflow.v2beta1.Conversations" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Conversations_SuggestConversationSummary_async", - "title": "dialogflow suggestConversationSummary Sample", - "origin": "API_DEFINITION", - "description": " Suggest summary for a conversation based on specific historical messages. The range of the messages to be used for summary can be specified in the request.", - "canonical": true, - "file": "conversations.suggest_conversation_summary.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SuggestConversationSummary", - "fullName": "google.cloud.dialogflow.v2beta1.Conversations.SuggestConversationSummary", - "async": true, - "parameters": [ - { - "name": "conversation", - "type": "TYPE_STRING" - }, - { - "name": "latest_message", - "type": "TYPE_STRING" - }, - { - "name": "context_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse", - "client": { - "shortName": "ConversationsClient", - "fullName": "google.cloud.dialogflow.v2beta1.ConversationsClient" - }, - "method": { - "shortName": "SuggestConversationSummary", - "fullName": "google.cloud.dialogflow.v2beta1.Conversations.SuggestConversationSummary", - "service": { - "shortName": "Conversations", - "fullName": "google.cloud.dialogflow.v2beta1.Conversations" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Documents_ListDocuments_async", - "title": "dialogflow listDocuments Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of all documents of the knowledge base. Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.", - "canonical": true, - "file": "documents.list_documents.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDocuments", - "fullName": "google.cloud.dialogflow.v2beta1.Documents.ListDocuments", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.ListDocumentsResponse", - "client": { - "shortName": "DocumentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.DocumentsClient" - }, - "method": { - "shortName": "ListDocuments", - "fullName": "google.cloud.dialogflow.v2beta1.Documents.ListDocuments", - "service": { - "shortName": "Documents", - "fullName": "google.cloud.dialogflow.v2beta1.Documents" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Documents_GetDocument_async", - "title": "dialogflow getDocument Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the specified document. Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.", - "canonical": true, - "file": "documents.get_document.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDocument", - "fullName": "google.cloud.dialogflow.v2beta1.Documents.GetDocument", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.Document", - "client": { - "shortName": "DocumentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.DocumentsClient" - }, - "method": { - "shortName": "GetDocument", - "fullName": "google.cloud.dialogflow.v2beta1.Documents.GetDocument", - "service": { - "shortName": "Documents", - "fullName": "google.cloud.dialogflow.v2beta1.Documents" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Documents_CreateDocument_async", - "title": "dialogflow createDocument Sample", - "origin": "API_DEFINITION", - "description": " Creates a new document. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] - `response`: [Document][google.cloud.dialogflow.v2beta1.Document] Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.", - "canonical": true, - "file": "documents.create_document.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateDocument", - "fullName": "google.cloud.dialogflow.v2beta1.Documents.CreateDocument", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "document", - "type": ".google.cloud.dialogflow.v2beta1.Document" - }, - { - "name": "import_gcs_custom_metadata", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DocumentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.DocumentsClient" - }, - "method": { - "shortName": "CreateDocument", - "fullName": "google.cloud.dialogflow.v2beta1.Documents.CreateDocument", - "service": { - "shortName": "Documents", - "fullName": "google.cloud.dialogflow.v2beta1.Documents" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Documents_ImportDocuments_async", - "title": "dialogflow importDocuments Sample", - "origin": "API_DEFINITION", - "description": " 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. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] - `response`: [ImportDocumentsResponse][google.cloud.dialogflow.v2beta1.ImportDocumentsResponse]", - "canonical": true, - "file": "documents.import_documents.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportDocuments", - "fullName": "google.cloud.dialogflow.v2beta1.Documents.ImportDocuments", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "gcs_source", - "type": ".google.cloud.dialogflow.v2beta1.GcsSources" - }, - { - "name": "document_template", - "type": ".google.cloud.dialogflow.v2beta1.ImportDocumentTemplate" - }, - { - "name": "import_gcs_custom_metadata", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DocumentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.DocumentsClient" - }, - "method": { - "shortName": "ImportDocuments", - "fullName": "google.cloud.dialogflow.v2beta1.Documents.ImportDocuments", - "service": { - "shortName": "Documents", - "fullName": "google.cloud.dialogflow.v2beta1.Documents" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Documents_DeleteDocument_async", - "title": "dialogflow deleteDocument Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified document. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.", - "canonical": true, - "file": "documents.delete_document.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteDocument", - "fullName": "google.cloud.dialogflow.v2beta1.Documents.DeleteDocument", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DocumentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.DocumentsClient" - }, - "method": { - "shortName": "DeleteDocument", - "fullName": "google.cloud.dialogflow.v2beta1.Documents.DeleteDocument", - "service": { - "shortName": "Documents", - "fullName": "google.cloud.dialogflow.v2beta1.Documents" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Documents_UpdateDocument_async", - "title": "dialogflow updateDocument Sample", - "origin": "API_DEFINITION", - "description": " Updates the specified document. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] - `response`: [Document][google.cloud.dialogflow.v2beta1.Document] Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.", - "canonical": true, - "file": "documents.update_document.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateDocument", - "fullName": "google.cloud.dialogflow.v2beta1.Documents.UpdateDocument", - "async": true, - "parameters": [ - { - "name": "document", - "type": ".google.cloud.dialogflow.v2beta1.Document" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DocumentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.DocumentsClient" - }, - "method": { - "shortName": "UpdateDocument", - "fullName": "google.cloud.dialogflow.v2beta1.Documents.UpdateDocument", - "service": { - "shortName": "Documents", - "fullName": "google.cloud.dialogflow.v2beta1.Documents" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Documents_ReloadDocument_async", - "title": "dialogflow reloadDocument Sample", - "origin": "API_DEFINITION", - "description": " 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. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] - `response`: [Document][google.cloud.dialogflow.v2beta1.Document] Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.", - "canonical": true, - "file": "documents.reload_document.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReloadDocument", - "fullName": "google.cloud.dialogflow.v2beta1.Documents.ReloadDocument", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "gcs_source", - "type": ".google.cloud.dialogflow.v2beta1.GcsSource" - }, - { - "name": "import_gcs_custom_metadata", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DocumentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.DocumentsClient" - }, - "method": { - "shortName": "ReloadDocument", - "fullName": "google.cloud.dialogflow.v2beta1.Documents.ReloadDocument", - "service": { - "shortName": "Documents", - "fullName": "google.cloud.dialogflow.v2beta1.Documents" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_EntityTypes_ListEntityTypes_async", - "title": "dialogflow listEntityTypes Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of all entity types in the specified agent.", - "canonical": true, - "file": "entity_types.list_entity_types.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListEntityTypes", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.ListEntityTypesResponse", - "client": { - "shortName": "EntityTypesClient", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" - }, - "method": { - "shortName": "ListEntityTypes", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes", - "service": { - "shortName": "EntityTypes", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_EntityTypes_GetEntityType_async", - "title": "dialogflow getEntityType Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the specified entity type.", - "canonical": true, - "file": "entity_types.get_entity_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetEntityType", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.GetEntityType", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.EntityType", - "client": { - "shortName": "EntityTypesClient", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" - }, - "method": { - "shortName": "GetEntityType", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.GetEntityType", - "service": { - "shortName": "EntityTypes", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_EntityTypes_CreateEntityType_async", - "title": "dialogflow createEntityType Sample", - "origin": "API_DEFINITION", - "description": " 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).", - "canonical": true, - "file": "entity_types.create_entity_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateEntityType", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.CreateEntityType", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "entity_type", - "type": ".google.cloud.dialogflow.v2beta1.EntityType" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.EntityType", - "client": { - "shortName": "EntityTypesClient", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" - }, - "method": { - "shortName": "CreateEntityType", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.CreateEntityType", - "service": { - "shortName": "EntityTypes", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_EntityTypes_UpdateEntityType_async", - "title": "dialogflow updateEntityType Sample", - "origin": "API_DEFINITION", - "description": " 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).", - "canonical": true, - "file": "entity_types.update_entity_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateEntityType", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.UpdateEntityType", - "async": true, - "parameters": [ - { - "name": "entity_type", - "type": ".google.cloud.dialogflow.v2beta1.EntityType" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.EntityType", - "client": { - "shortName": "EntityTypesClient", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" - }, - "method": { - "shortName": "UpdateEntityType", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.UpdateEntityType", - "service": { - "shortName": "EntityTypes", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_EntityTypes_DeleteEntityType_async", - "title": "dialogflow deleteEntityType Sample", - "origin": "API_DEFINITION", - "description": " 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).", - "canonical": true, - "file": "entity_types.delete_entity_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteEntityType", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.DeleteEntityType", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "EntityTypesClient", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" - }, - "method": { - "shortName": "DeleteEntityType", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.DeleteEntityType", - "service": { - "shortName": "EntityTypes", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntityTypes_async", - "title": "dialogflow batchUpdateEntityTypes Sample", - "origin": "API_DEFINITION", - "description": " Updates/Creates multiple entity types in the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [BatchUpdateEntityTypesResponse][google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse] Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", - "canonical": true, - "file": "entity_types.batch_update_entity_types.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchUpdateEntityTypes", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "entity_type_batch_uri", - "type": "TYPE_STRING" - }, - { - "name": "entity_type_batch_inline", - "type": ".google.cloud.dialogflow.v2beta1.EntityTypeBatch" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "EntityTypesClient", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" - }, - "method": { - "shortName": "BatchUpdateEntityTypes", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes", - "service": { - "shortName": "EntityTypes", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntityTypes_async", - "title": "dialogflow batchDeleteEntityTypes Sample", - "origin": "API_DEFINITION", - "description": " Deletes entity types in the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", - "canonical": true, - "file": "entity_types.batch_delete_entity_types.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchDeleteEntityTypes", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntityTypes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "entity_type_names", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "EntityTypesClient", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" - }, - "method": { - "shortName": "BatchDeleteEntityTypes", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntityTypes", - "service": { - "shortName": "EntityTypes", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_EntityTypes_BatchCreateEntities_async", - "title": "dialogflow batchCreateEntities Sample", - "origin": "API_DEFINITION", - "description": " Creates multiple new entities in the specified entity type. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", - "canonical": true, - "file": "entity_types.batch_create_entities.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchCreateEntities", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchCreateEntities", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "entities", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "EntityTypesClient", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" - }, - "method": { - "shortName": "BatchCreateEntities", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchCreateEntities", - "service": { - "shortName": "EntityTypes", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntities_async", - "title": "dialogflow batchUpdateEntities Sample", - "origin": "API_DEFINITION", - "description": " 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). This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)", - "canonical": true, - "file": "entity_types.batch_update_entities.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchUpdateEntities", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntities", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "entities", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "EntityTypesClient", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" - }, - "method": { - "shortName": "BatchUpdateEntities", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntities", - "service": { - "shortName": "EntityTypes", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntities_async", - "title": "dialogflow batchDeleteEntities Sample", - "origin": "API_DEFINITION", - "description": " Deletes entities in the specified entity type. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", - "canonical": true, - "file": "entity_types.batch_delete_entities.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchDeleteEntities", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntities", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "entity_values", - "type": "TYPE_STRING[]" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "EntityTypesClient", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" - }, - "method": { - "shortName": "BatchDeleteEntities", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntities", - "service": { - "shortName": "EntityTypes", - "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Environments_ListEnvironments_async", - "title": "dialogflow listEnvironments Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of all non-draft environments of the specified agent.", - "canonical": true, - "file": "environments.list_environments.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListEnvironments", - "fullName": "google.cloud.dialogflow.v2beta1.Environments.ListEnvironments", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse", - "client": { - "shortName": "EnvironmentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.EnvironmentsClient" - }, - "method": { - "shortName": "ListEnvironments", - "fullName": "google.cloud.dialogflow.v2beta1.Environments.ListEnvironments", - "service": { - "shortName": "Environments", - "fullName": "google.cloud.dialogflow.v2beta1.Environments" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Environments_GetEnvironment_async", - "title": "dialogflow getEnvironment Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the specified agent environment.", - "canonical": true, - "file": "environments.get_environment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetEnvironment", - "fullName": "google.cloud.dialogflow.v2beta1.Environments.GetEnvironment", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.Environment", - "client": { - "shortName": "EnvironmentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.EnvironmentsClient" - }, - "method": { - "shortName": "GetEnvironment", - "fullName": "google.cloud.dialogflow.v2beta1.Environments.GetEnvironment", - "service": { - "shortName": "Environments", - "fullName": "google.cloud.dialogflow.v2beta1.Environments" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Environments_CreateEnvironment_async", - "title": "dialogflow createEnvironment Sample", - "origin": "API_DEFINITION", - "description": " Creates an agent environment.", - "canonical": true, - "file": "environments.create_environment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateEnvironment", - "fullName": "google.cloud.dialogflow.v2beta1.Environments.CreateEnvironment", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "environment", - "type": ".google.cloud.dialogflow.v2beta1.Environment" - }, - { - "name": "environment_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.Environment", - "client": { - "shortName": "EnvironmentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.EnvironmentsClient" - }, - "method": { - "shortName": "CreateEnvironment", - "fullName": "google.cloud.dialogflow.v2beta1.Environments.CreateEnvironment", - "service": { - "shortName": "Environments", - "fullName": "google.cloud.dialogflow.v2beta1.Environments" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Environments_UpdateEnvironment_async", - "title": "dialogflow updateEnvironment Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "environments.update_environment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateEnvironment", - "fullName": "google.cloud.dialogflow.v2beta1.Environments.UpdateEnvironment", - "async": true, - "parameters": [ - { - "name": "environment", - "type": ".google.cloud.dialogflow.v2beta1.Environment" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "allow_load_to_draft_and_discard_changes", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.Environment", - "client": { - "shortName": "EnvironmentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.EnvironmentsClient" - }, - "method": { - "shortName": "UpdateEnvironment", - "fullName": "google.cloud.dialogflow.v2beta1.Environments.UpdateEnvironment", - "service": { - "shortName": "Environments", - "fullName": "google.cloud.dialogflow.v2beta1.Environments" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Environments_DeleteEnvironment_async", - "title": "dialogflow deleteEnvironment Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified agent environment.", - "canonical": true, - "file": "environments.delete_environment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteEnvironment", - "fullName": "google.cloud.dialogflow.v2beta1.Environments.DeleteEnvironment", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "EnvironmentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.EnvironmentsClient" - }, - "method": { - "shortName": "DeleteEnvironment", - "fullName": "google.cloud.dialogflow.v2beta1.Environments.DeleteEnvironment", - "service": { - "shortName": "Environments", - "fullName": "google.cloud.dialogflow.v2beta1.Environments" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Environments_GetEnvironmentHistory_async", - "title": "dialogflow getEnvironmentHistory Sample", - "origin": "API_DEFINITION", - "description": " Gets the history of the specified environment.", - "canonical": true, - "file": "environments.get_environment_history.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetEnvironmentHistory", - "fullName": "google.cloud.dialogflow.v2beta1.Environments.GetEnvironmentHistory", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.EnvironmentHistory", - "client": { - "shortName": "EnvironmentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.EnvironmentsClient" - }, - "method": { - "shortName": "GetEnvironmentHistory", - "fullName": "google.cloud.dialogflow.v2beta1.Environments.GetEnvironmentHistory", - "service": { - "shortName": "Environments", - "fullName": "google.cloud.dialogflow.v2beta1.Environments" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Fulfillments_GetFulfillment_async", - "title": "dialogflow getFulfillment Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the fulfillment.", - "canonical": true, - "file": "fulfillments.get_fulfillment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFulfillment", - "fullName": "google.cloud.dialogflow.v2beta1.Fulfillments.GetFulfillment", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.Fulfillment", - "client": { - "shortName": "FulfillmentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.FulfillmentsClient" - }, - "method": { - "shortName": "GetFulfillment", - "fullName": "google.cloud.dialogflow.v2beta1.Fulfillments.GetFulfillment", - "service": { - "shortName": "Fulfillments", - "fullName": "google.cloud.dialogflow.v2beta1.Fulfillments" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Fulfillments_UpdateFulfillment_async", - "title": "dialogflow updateFulfillment Sample", - "origin": "API_DEFINITION", - "description": " Updates the fulfillment.", - "canonical": true, - "file": "fulfillments.update_fulfillment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateFulfillment", - "fullName": "google.cloud.dialogflow.v2beta1.Fulfillments.UpdateFulfillment", - "async": true, - "parameters": [ - { - "name": "fulfillment", - "type": ".google.cloud.dialogflow.v2beta1.Fulfillment" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.Fulfillment", - "client": { - "shortName": "FulfillmentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.FulfillmentsClient" - }, - "method": { - "shortName": "UpdateFulfillment", - "fullName": "google.cloud.dialogflow.v2beta1.Fulfillments.UpdateFulfillment", - "service": { - "shortName": "Fulfillments", - "fullName": "google.cloud.dialogflow.v2beta1.Fulfillments" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Intents_ListIntents_async", - "title": "dialogflow listIntents Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of all intents in the specified agent.", - "canonical": true, - "file": "intents.list_intents.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListIntents", - "fullName": "google.cloud.dialogflow.v2beta1.Intents.ListIntents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "intent_view", - "type": ".google.cloud.dialogflow.v2beta1.IntentView" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.ListIntentsResponse", - "client": { - "shortName": "IntentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.IntentsClient" - }, - "method": { - "shortName": "ListIntents", - "fullName": "google.cloud.dialogflow.v2beta1.Intents.ListIntents", - "service": { - "shortName": "Intents", - "fullName": "google.cloud.dialogflow.v2beta1.Intents" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Intents_GetIntent_async", - "title": "dialogflow getIntent Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the specified intent.", - "canonical": true, - "file": "intents.get_intent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIntent", - "fullName": "google.cloud.dialogflow.v2beta1.Intents.GetIntent", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "intent_view", - "type": ".google.cloud.dialogflow.v2beta1.IntentView" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.Intent", - "client": { - "shortName": "IntentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.IntentsClient" - }, - "method": { - "shortName": "GetIntent", - "fullName": "google.cloud.dialogflow.v2beta1.Intents.GetIntent", - "service": { - "shortName": "Intents", - "fullName": "google.cloud.dialogflow.v2beta1.Intents" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Intents_CreateIntent_async", - "title": "dialogflow createIntent Sample", - "origin": "API_DEFINITION", - "description": " 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).", - "canonical": true, - "file": "intents.create_intent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateIntent", - "fullName": "google.cloud.dialogflow.v2beta1.Intents.CreateIntent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "intent", - "type": ".google.cloud.dialogflow.v2beta1.Intent" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "intent_view", - "type": ".google.cloud.dialogflow.v2beta1.IntentView" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.Intent", - "client": { - "shortName": "IntentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.IntentsClient" - }, - "method": { - "shortName": "CreateIntent", - "fullName": "google.cloud.dialogflow.v2beta1.Intents.CreateIntent", - "service": { - "shortName": "Intents", - "fullName": "google.cloud.dialogflow.v2beta1.Intents" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Intents_UpdateIntent_async", - "title": "dialogflow updateIntent Sample", - "origin": "API_DEFINITION", - "description": " 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).", - "canonical": true, - "file": "intents.update_intent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateIntent", - "fullName": "google.cloud.dialogflow.v2beta1.Intents.UpdateIntent", - "async": true, - "parameters": [ - { - "name": "intent", - "type": ".google.cloud.dialogflow.v2beta1.Intent" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "intent_view", - "type": ".google.cloud.dialogflow.v2beta1.IntentView" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.Intent", - "client": { - "shortName": "IntentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.IntentsClient" - }, - "method": { - "shortName": "UpdateIntent", - "fullName": "google.cloud.dialogflow.v2beta1.Intents.UpdateIntent", - "service": { - "shortName": "Intents", - "fullName": "google.cloud.dialogflow.v2beta1.Intents" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Intents_DeleteIntent_async", - "title": "dialogflow deleteIntent Sample", - "origin": "API_DEFINITION", - "description": " 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).", - "canonical": true, - "file": "intents.delete_intent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteIntent", - "fullName": "google.cloud.dialogflow.v2beta1.Intents.DeleteIntent", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "IntentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.IntentsClient" - }, - "method": { - "shortName": "DeleteIntent", - "fullName": "google.cloud.dialogflow.v2beta1.Intents.DeleteIntent", - "service": { - "shortName": "Intents", - "fullName": "google.cloud.dialogflow.v2beta1.Intents" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Intents_BatchUpdateIntents_async", - "title": "dialogflow batchUpdateIntents Sample", - "origin": "API_DEFINITION", - "description": " Updates/Creates multiple intents in the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse] Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", - "canonical": true, - "file": "intents.batch_update_intents.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchUpdateIntents", - "fullName": "google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "intent_batch_uri", - "type": "TYPE_STRING" - }, - { - "name": "intent_batch_inline", - "type": ".google.cloud.dialogflow.v2beta1.IntentBatch" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "intent_view", - "type": ".google.cloud.dialogflow.v2beta1.IntentView" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "IntentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.IntentsClient" - }, - "method": { - "shortName": "BatchUpdateIntents", - "fullName": "google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents", - "service": { - "shortName": "Intents", - "fullName": "google.cloud.dialogflow.v2beta1.Intents" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Intents_BatchDeleteIntents_async", - "title": "dialogflow batchDeleteIntents Sample", - "origin": "API_DEFINITION", - "description": " Deletes intents in the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", - "canonical": true, - "file": "intents.batch_delete_intents.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchDeleteIntents", - "fullName": "google.cloud.dialogflow.v2beta1.Intents.BatchDeleteIntents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "intents", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "IntentsClient", - "fullName": "google.cloud.dialogflow.v2beta1.IntentsClient" - }, - "method": { - "shortName": "BatchDeleteIntents", - "fullName": "google.cloud.dialogflow.v2beta1.Intents.BatchDeleteIntents", - "service": { - "shortName": "Intents", - "fullName": "google.cloud.dialogflow.v2beta1.Intents" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_KnowledgeBases_ListKnowledgeBases_async", - "title": "dialogflow listKnowledgeBases Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of all knowledge bases of the specified agent. Note: The `projects.agent.knowledgeBases` resource is deprecated; only use `projects.knowledgeBases`.", - "canonical": true, - "file": "knowledge_bases.list_knowledge_bases.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 87, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListKnowledgeBases", - "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse", - "client": { - "shortName": "KnowledgeBasesClient", - "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBasesClient" - }, - "method": { - "shortName": "ListKnowledgeBases", - "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases", - "service": { - "shortName": "KnowledgeBases", - "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_KnowledgeBases_GetKnowledgeBase_async", - "title": "dialogflow getKnowledgeBase Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the specified knowledge base. Note: The `projects.agent.knowledgeBases` resource is deprecated; only use `projects.knowledgeBases`.", - "canonical": true, - "file": "knowledge_bases.get_knowledge_base.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetKnowledgeBase", - "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.GetKnowledgeBase", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.KnowledgeBase", - "client": { - "shortName": "KnowledgeBasesClient", - "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBasesClient" - }, - "method": { - "shortName": "GetKnowledgeBase", - "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.GetKnowledgeBase", - "service": { - "shortName": "KnowledgeBases", - "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_KnowledgeBases_CreateKnowledgeBase_async", - "title": "dialogflow createKnowledgeBase Sample", - "origin": "API_DEFINITION", - "description": " Creates a knowledge base. Note: The `projects.agent.knowledgeBases` resource is deprecated; only use `projects.knowledgeBases`.", - "canonical": true, - "file": "knowledge_bases.create_knowledge_base.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateKnowledgeBase", - "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.CreateKnowledgeBase", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "knowledge_base", - "type": ".google.cloud.dialogflow.v2beta1.KnowledgeBase" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.KnowledgeBase", - "client": { - "shortName": "KnowledgeBasesClient", - "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBasesClient" - }, - "method": { - "shortName": "CreateKnowledgeBase", - "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.CreateKnowledgeBase", - "service": { - "shortName": "KnowledgeBases", - "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_KnowledgeBases_DeleteKnowledgeBase_async", - "title": "dialogflow deleteKnowledgeBase Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified knowledge base. Note: The `projects.agent.knowledgeBases` resource is deprecated; only use `projects.knowledgeBases`.", - "canonical": true, - "file": "knowledge_bases.delete_knowledge_base.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteKnowledgeBase", - "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.DeleteKnowledgeBase", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "KnowledgeBasesClient", - "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBasesClient" - }, - "method": { - "shortName": "DeleteKnowledgeBase", - "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.DeleteKnowledgeBase", - "service": { - "shortName": "KnowledgeBases", - "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_KnowledgeBases_UpdateKnowledgeBase_async", - "title": "dialogflow updateKnowledgeBase Sample", - "origin": "API_DEFINITION", - "description": " Updates the specified knowledge base. Note: The `projects.agent.knowledgeBases` resource is deprecated; only use `projects.knowledgeBases`.", - "canonical": true, - "file": "knowledge_bases.update_knowledge_base.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateKnowledgeBase", - "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.UpdateKnowledgeBase", - "async": true, - "parameters": [ - { - "name": "knowledge_base", - "type": ".google.cloud.dialogflow.v2beta1.KnowledgeBase" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.KnowledgeBase", - "client": { - "shortName": "KnowledgeBasesClient", - "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBasesClient" - }, - "method": { - "shortName": "UpdateKnowledgeBase", - "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.UpdateKnowledgeBase", - "service": { - "shortName": "KnowledgeBases", - "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Participants_CreateParticipant_async", - "title": "dialogflow createParticipant Sample", - "origin": "API_DEFINITION", - "description": " Creates a new participant in a conversation.", - "canonical": true, - "file": "participants.create_participant.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateParticipant", - "fullName": "google.cloud.dialogflow.v2beta1.Participants.CreateParticipant", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "participant", - "type": ".google.cloud.dialogflow.v2beta1.Participant" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.Participant", - "client": { - "shortName": "ParticipantsClient", - "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" - }, - "method": { - "shortName": "CreateParticipant", - "fullName": "google.cloud.dialogflow.v2beta1.Participants.CreateParticipant", - "service": { - "shortName": "Participants", - "fullName": "google.cloud.dialogflow.v2beta1.Participants" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Participants_GetParticipant_async", - "title": "dialogflow getParticipant Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a conversation participant.", - "canonical": true, - "file": "participants.get_participant.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetParticipant", - "fullName": "google.cloud.dialogflow.v2beta1.Participants.GetParticipant", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.Participant", - "client": { - "shortName": "ParticipantsClient", - "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" - }, - "method": { - "shortName": "GetParticipant", - "fullName": "google.cloud.dialogflow.v2beta1.Participants.GetParticipant", - "service": { - "shortName": "Participants", - "fullName": "google.cloud.dialogflow.v2beta1.Participants" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Participants_ListParticipants_async", - "title": "dialogflow listParticipants Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of all participants in the specified conversation.", - "canonical": true, - "file": "participants.list_participants.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListParticipants", - "fullName": "google.cloud.dialogflow.v2beta1.Participants.ListParticipants", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.ListParticipantsResponse", - "client": { - "shortName": "ParticipantsClient", - "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" - }, - "method": { - "shortName": "ListParticipants", - "fullName": "google.cloud.dialogflow.v2beta1.Participants.ListParticipants", - "service": { - "shortName": "Participants", - "fullName": "google.cloud.dialogflow.v2beta1.Participants" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Participants_UpdateParticipant_async", - "title": "dialogflow updateParticipant Sample", - "origin": "API_DEFINITION", - "description": " Updates the specified participant.", - "canonical": true, - "file": "participants.update_participant.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateParticipant", - "fullName": "google.cloud.dialogflow.v2beta1.Participants.UpdateParticipant", - "async": true, - "parameters": [ - { - "name": "participant", - "type": ".google.cloud.dialogflow.v2beta1.Participant" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.Participant", - "client": { - "shortName": "ParticipantsClient", - "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" - }, - "method": { - "shortName": "UpdateParticipant", - "fullName": "google.cloud.dialogflow.v2beta1.Participants.UpdateParticipant", - "service": { - "shortName": "Participants", - "fullName": "google.cloud.dialogflow.v2beta1.Participants" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Participants_AnalyzeContent_async", - "title": "dialogflow analyzeContent Sample", - "origin": "API_DEFINITION", - "description": " 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).", - "canonical": true, - "file": "participants.analyze_content.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 127, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AnalyzeContent", - "fullName": "google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent", - "async": true, - "parameters": [ - { - "name": "participant", - "type": "TYPE_STRING" - }, - { - "name": "text_input", - "type": ".google.cloud.dialogflow.v2beta1.TextInput" - }, - { - "name": "audio_input", - "type": ".google.cloud.dialogflow.v2beta1.AudioInput" - }, - { - "name": "event_input", - "type": ".google.cloud.dialogflow.v2beta1.EventInput" - }, - { - "name": "reply_audio_config", - "type": ".google.cloud.dialogflow.v2beta1.OutputAudioConfig" - }, - { - "name": "query_params", - "type": ".google.cloud.dialogflow.v2beta1.QueryParameters" - }, - { - "name": "assist_query_params", - "type": ".google.cloud.dialogflow.v2beta1.AssistQueryParameters" - }, - { - "name": "cx_parameters", - "type": ".google.protobuf.Struct" - }, - { - "name": "cx_current_page", - "type": "TYPE_STRING" - }, - { - "name": "message_send_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.AnalyzeContentResponse", - "client": { - "shortName": "ParticipantsClient", - "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" - }, - "method": { - "shortName": "AnalyzeContent", - "fullName": "google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent", - "service": { - "shortName": "Participants", - "fullName": "google.cloud.dialogflow.v2beta1.Participants" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Participants_StreamingAnalyzeContent_async", - "title": "dialogflow streamingAnalyzeContent Sample", - "origin": "API_DEFINITION", - "description": " Adds a text (e.g., chat) or audio (e.g., phone recording) message from a participant into the conversation. Note: This method is only available through the gRPC API (not REST). The top-level message sent to the client by the server is `StreamingAnalyzeContentResponse`. Multiple response messages can be returned in order. The first one or more messages contain the `recognition_result` field. Each result represents a more complete transcript of what the user said. The next message contains the `reply_text` field, and potentially the `reply_audio` and/or the `automated_agent_reply` fields. 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).", - "canonical": true, - "file": "participants.streaming_analyze_content.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 132, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StreamingAnalyzeContent", - "fullName": "google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent", - "async": true, - "parameters": [ - { - "name": "participant", - "type": "TYPE_STRING" - }, - { - "name": "audio_config", - "type": ".google.cloud.dialogflow.v2beta1.InputAudioConfig" - }, - { - "name": "text_config", - "type": ".google.cloud.dialogflow.v2beta1.InputTextConfig" - }, - { - "name": "reply_audio_config", - "type": ".google.cloud.dialogflow.v2beta1.OutputAudioConfig" - }, - { - "name": "input_audio", - "type": "TYPE_BYTES" - }, - { - "name": "input_text", - "type": "TYPE_STRING" - }, - { - "name": "input_dtmf", - "type": ".google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents" - }, - { - "name": "query_params", - "type": ".google.cloud.dialogflow.v2beta1.QueryParameters" - }, - { - "name": "assist_query_params", - "type": ".google.cloud.dialogflow.v2beta1.AssistQueryParameters" - }, - { - "name": "cx_parameters", - "type": ".google.protobuf.Struct" - }, - { - "name": "cx_current_page", - "type": "TYPE_STRING" - }, - { - "name": "enable_partial_automated_agent_reply", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse", - "client": { - "shortName": "ParticipantsClient", - "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" - }, - "method": { - "shortName": "StreamingAnalyzeContent", - "fullName": "google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent", - "service": { - "shortName": "Participants", - "fullName": "google.cloud.dialogflow.v2beta1.Participants" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Participants_SuggestArticles_async", - "title": "dialogflow suggestArticles Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "participants.suggest_articles.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SuggestArticles", - "fullName": "google.cloud.dialogflow.v2beta1.Participants.SuggestArticles", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "latest_message", - "type": "TYPE_STRING" - }, - { - "name": "context_size", - "type": "TYPE_INT32" - }, - { - "name": "assist_query_params", - "type": ".google.cloud.dialogflow.v2beta1.AssistQueryParameters" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.SuggestArticlesResponse", - "client": { - "shortName": "ParticipantsClient", - "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" - }, - "method": { - "shortName": "SuggestArticles", - "fullName": "google.cloud.dialogflow.v2beta1.Participants.SuggestArticles", - "service": { - "shortName": "Participants", - "fullName": "google.cloud.dialogflow.v2beta1.Participants" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Participants_SuggestFaqAnswers_async", - "title": "dialogflow suggestFaqAnswers Sample", - "origin": "API_DEFINITION", - "description": " Gets suggested faq answers for a participant based on specific historical messages.", - "canonical": true, - "file": "participants.suggest_faq_answers.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SuggestFaqAnswers", - "fullName": "google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "latest_message", - "type": "TYPE_STRING" - }, - { - "name": "context_size", - "type": "TYPE_INT32" - }, - { - "name": "assist_query_params", - "type": ".google.cloud.dialogflow.v2beta1.AssistQueryParameters" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse", - "client": { - "shortName": "ParticipantsClient", - "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" - }, - "method": { - "shortName": "SuggestFaqAnswers", - "fullName": "google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers", - "service": { - "shortName": "Participants", - "fullName": "google.cloud.dialogflow.v2beta1.Participants" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Participants_SuggestSmartReplies_async", - "title": "dialogflow suggestSmartReplies Sample", - "origin": "API_DEFINITION", - "description": " Gets smart replies for a participant based on specific historical messages.", - "canonical": true, - "file": "participants.suggest_smart_replies.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SuggestSmartReplies", - "fullName": "google.cloud.dialogflow.v2beta1.Participants.SuggestSmartReplies", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "current_text_input", - "type": ".google.cloud.dialogflow.v2beta1.TextInput" - }, - { - "name": "latest_message", - "type": "TYPE_STRING" - }, - { - "name": "context_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse", - "client": { - "shortName": "ParticipantsClient", - "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" - }, - "method": { - "shortName": "SuggestSmartReplies", - "fullName": "google.cloud.dialogflow.v2beta1.Participants.SuggestSmartReplies", - "service": { - "shortName": "Participants", - "fullName": "google.cloud.dialogflow.v2beta1.Participants" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Participants_ListSuggestions_async", - "title": "dialogflow listSuggestions Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "participants.list_suggestions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSuggestions", - "fullName": "google.cloud.dialogflow.v2beta1.Participants.ListSuggestions", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.ListSuggestionsResponse", - "client": { - "shortName": "ParticipantsClient", - "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" - }, - "method": { - "shortName": "ListSuggestions", - "fullName": "google.cloud.dialogflow.v2beta1.Participants.ListSuggestions", - "service": { - "shortName": "Participants", - "fullName": "google.cloud.dialogflow.v2beta1.Participants" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Participants_CompileSuggestion_async", - "title": "dialogflow compileSuggestion Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "participants.compile_suggestion.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CompileSuggestion", - "fullName": "google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "latest_message", - "type": "TYPE_STRING" - }, - { - "name": "context_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.CompileSuggestionResponse", - "client": { - "shortName": "ParticipantsClient", - "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" - }, - "method": { - "shortName": "CompileSuggestion", - "fullName": "google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion", - "service": { - "shortName": "Participants", - "fullName": "google.cloud.dialogflow.v2beta1.Participants" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_SessionEntityTypes_ListSessionEntityTypes_async", - "title": "dialogflow listSessionEntityTypes Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "session_entity_types.list_session_entity_types.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSessionEntityTypes", - "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse", - "client": { - "shortName": "SessionEntityTypesClient", - "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypesClient" - }, - "method": { - "shortName": "ListSessionEntityTypes", - "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes", - "service": { - "shortName": "SessionEntityTypes", - "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_SessionEntityTypes_GetSessionEntityType_async", - "title": "dialogflow getSessionEntityType Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "session_entity_types.get_session_entity_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSessionEntityType", - "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.GetSessionEntityType", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.SessionEntityType", - "client": { - "shortName": "SessionEntityTypesClient", - "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypesClient" - }, - "method": { - "shortName": "GetSessionEntityType", - "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.GetSessionEntityType", - "service": { - "shortName": "SessionEntityTypes", - "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_SessionEntityTypes_CreateSessionEntityType_async", - "title": "dialogflow createSessionEntityType Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "session_entity_types.create_session_entity_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateSessionEntityType", - "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.CreateSessionEntityType", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "session_entity_type", - "type": ".google.cloud.dialogflow.v2beta1.SessionEntityType" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.SessionEntityType", - "client": { - "shortName": "SessionEntityTypesClient", - "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypesClient" - }, - "method": { - "shortName": "CreateSessionEntityType", - "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.CreateSessionEntityType", - "service": { - "shortName": "SessionEntityTypes", - "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_SessionEntityTypes_UpdateSessionEntityType_async", - "title": "dialogflow updateSessionEntityType Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "session_entity_types.update_session_entity_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSessionEntityType", - "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.UpdateSessionEntityType", - "async": true, - "parameters": [ - { - "name": "session_entity_type", - "type": ".google.cloud.dialogflow.v2beta1.SessionEntityType" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.SessionEntityType", - "client": { - "shortName": "SessionEntityTypesClient", - "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypesClient" - }, - "method": { - "shortName": "UpdateSessionEntityType", - "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.UpdateSessionEntityType", - "service": { - "shortName": "SessionEntityTypes", - "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_SessionEntityTypes_DeleteSessionEntityType_async", - "title": "dialogflow deleteSessionEntityType Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "session_entity_types.delete_session_entity_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteSessionEntityType", - "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.DeleteSessionEntityType", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "SessionEntityTypesClient", - "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypesClient" - }, - "method": { - "shortName": "DeleteSessionEntityType", - "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.DeleteSessionEntityType", - "service": { - "shortName": "SessionEntityTypes", - "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Sessions_DetectIntent_async", - "title": "dialogflow detectIntent Sample", - "origin": "API_DEFINITION", - "description": " 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. If you might use [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) or other CCAI products now or in the future, consider using [AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent] instead of `DetectIntent`. `AnalyzeContent` has additional functionality for Agent Assist and other CCAI products. Note: Always use agent versions for production traffic. See [Versions and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).", - "canonical": true, - "file": "sessions.detect_intent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 106, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DetectIntent", - "fullName": "google.cloud.dialogflow.v2beta1.Sessions.DetectIntent", - "async": true, - "parameters": [ - { - "name": "session", - "type": "TYPE_STRING" - }, - { - "name": "query_params", - "type": ".google.cloud.dialogflow.v2beta1.QueryParameters" - }, - { - "name": "query_input", - "type": ".google.cloud.dialogflow.v2beta1.QueryInput" - }, - { - "name": "output_audio_config", - "type": ".google.cloud.dialogflow.v2beta1.OutputAudioConfig" - }, - { - "name": "output_audio_config_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "input_audio", - "type": "TYPE_BYTES" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.DetectIntentResponse", - "client": { - "shortName": "SessionsClient", - "fullName": "google.cloud.dialogflow.v2beta1.SessionsClient" - }, - "method": { - "shortName": "DetectIntent", - "fullName": "google.cloud.dialogflow.v2beta1.Sessions.DetectIntent", - "service": { - "shortName": "Sessions", - "fullName": "google.cloud.dialogflow.v2beta1.Sessions" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Sessions_StreamingDetectIntent_async", - "title": "dialogflow streamingDetectIntent Sample", - "origin": "API_DEFINITION", - "description": " 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). If you might use [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) or other CCAI products now or in the future, consider using [StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent] instead of `StreamingDetectIntent`. `StreamingAnalyzeContent` has additional functionality for Agent Assist and other CCAI products. Note: Always use agent versions for production traffic. See [Versions and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).", - "canonical": true, - "file": "sessions.streaming_detect_intent.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 122, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StreamingDetectIntent", - "fullName": "google.cloud.dialogflow.v2beta1.Sessions.StreamingDetectIntent", - "async": true, - "parameters": [ - { - "name": "session", - "type": "TYPE_STRING" - }, - { - "name": "query_params", - "type": ".google.cloud.dialogflow.v2beta1.QueryParameters" - }, - { - "name": "query_input", - "type": ".google.cloud.dialogflow.v2beta1.QueryInput" - }, - { - "name": "single_utterance", - "type": "TYPE_BOOL" - }, - { - "name": "output_audio_config", - "type": ".google.cloud.dialogflow.v2beta1.OutputAudioConfig" - }, - { - "name": "output_audio_config_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "input_audio", - "type": "TYPE_BYTES" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse", - "client": { - "shortName": "SessionsClient", - "fullName": "google.cloud.dialogflow.v2beta1.SessionsClient" - }, - "method": { - "shortName": "StreamingDetectIntent", - "fullName": "google.cloud.dialogflow.v2beta1.Sessions.StreamingDetectIntent", - "service": { - "shortName": "Sessions", - "fullName": "google.cloud.dialogflow.v2beta1.Sessions" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Versions_ListVersions_async", - "title": "dialogflow listVersions Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of all versions of the specified agent.", - "canonical": true, - "file": "versions.list_versions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListVersions", - "fullName": "google.cloud.dialogflow.v2beta1.Versions.ListVersions", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.ListVersionsResponse", - "client": { - "shortName": "VersionsClient", - "fullName": "google.cloud.dialogflow.v2beta1.VersionsClient" - }, - "method": { - "shortName": "ListVersions", - "fullName": "google.cloud.dialogflow.v2beta1.Versions.ListVersions", - "service": { - "shortName": "Versions", - "fullName": "google.cloud.dialogflow.v2beta1.Versions" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Versions_GetVersion_async", - "title": "dialogflow getVersion Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the specified agent version.", - "canonical": true, - "file": "versions.get_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetVersion", - "fullName": "google.cloud.dialogflow.v2beta1.Versions.GetVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.Version", - "client": { - "shortName": "VersionsClient", - "fullName": "google.cloud.dialogflow.v2beta1.VersionsClient" - }, - "method": { - "shortName": "GetVersion", - "fullName": "google.cloud.dialogflow.v2beta1.Versions.GetVersion", - "service": { - "shortName": "Versions", - "fullName": "google.cloud.dialogflow.v2beta1.Versions" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Versions_CreateVersion_async", - "title": "dialogflow createVersion Sample", - "origin": "API_DEFINITION", - "description": " Creates an agent version. The new version points to the agent instance in the \"default\" environment.", - "canonical": true, - "file": "versions.create_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateVersion", - "fullName": "google.cloud.dialogflow.v2beta1.Versions.CreateVersion", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "version", - "type": ".google.cloud.dialogflow.v2beta1.Version" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.Version", - "client": { - "shortName": "VersionsClient", - "fullName": "google.cloud.dialogflow.v2beta1.VersionsClient" - }, - "method": { - "shortName": "CreateVersion", - "fullName": "google.cloud.dialogflow.v2beta1.Versions.CreateVersion", - "service": { - "shortName": "Versions", - "fullName": "google.cloud.dialogflow.v2beta1.Versions" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Versions_UpdateVersion_async", - "title": "dialogflow updateVersion Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "versions.update_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateVersion", - "fullName": "google.cloud.dialogflow.v2beta1.Versions.UpdateVersion", - "async": true, - "parameters": [ - { - "name": "version", - "type": ".google.cloud.dialogflow.v2beta1.Version" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.dialogflow.v2beta1.Version", - "client": { - "shortName": "VersionsClient", - "fullName": "google.cloud.dialogflow.v2beta1.VersionsClient" - }, - "method": { - "shortName": "UpdateVersion", - "fullName": "google.cloud.dialogflow.v2beta1.Versions.UpdateVersion", - "service": { - "shortName": "Versions", - "fullName": "google.cloud.dialogflow.v2beta1.Versions" - } - } - } - }, - { - "regionTag": "dialogflow_v2beta1_generated_Versions_DeleteVersion_async", - "title": "dialogflow deleteVersion Sample", - "origin": "API_DEFINITION", - "description": " Delete the specified agent version.", - "canonical": true, - "file": "versions.delete_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteVersion", - "fullName": "google.cloud.dialogflow.v2beta1.Versions.DeleteVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "VersionsClient", - "fullName": "google.cloud.dialogflow.v2beta1.VersionsClient" - }, - "method": { - "shortName": "DeleteVersion", - "fullName": "google.cloud.dialogflow.v2beta1.Versions.DeleteVersion", - "service": { - "shortName": "Versions", - "fullName": "google.cloud.dialogflow.v2beta1.Versions" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.create_version.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.create_version.js deleted file mode 100644 index 73e1b0b6a17..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.create_version.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2022 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'; - -function main(parent, version) { - // [START dialogflow_v2beta1_generated_Versions_CreateVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The agent to create a version for. - * Supported formats: - * - `projects//agent` - * - `projects//locations//agent` - */ - // const parent = 'abc123' - /** - * Required. The version to create. - */ - // const version = {} - - // Imports the Dialogflow library - const {VersionsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new VersionsClient(); - - async function callCreateVersion() { - // Construct request - const request = { - parent, - version, - }; - - // Run request - const response = await dialogflowClient.createVersion(request); - console.log(response); - } - - callCreateVersion(); - // [END dialogflow_v2beta1_generated_Versions_CreateVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.delete_version.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.delete_version.js deleted file mode 100644 index 7ab8dcac00b..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.delete_version.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2beta1_generated_Versions_DeleteVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the version to delete. - * Supported formats: - * - `projects//agent/versions/` - * - `projects//locations//agent/versions/` - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {VersionsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new VersionsClient(); - - async function callDeleteVersion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.deleteVersion(request); - console.log(response); - } - - callDeleteVersion(); - // [END dialogflow_v2beta1_generated_Versions_DeleteVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.get_version.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.get_version.js deleted file mode 100644 index b164412ede8..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.get_version.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 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'; - -function main(name) { - // [START dialogflow_v2beta1_generated_Versions_GetVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the version. - * Supported formats: - * - `projects//agent/versions/` - * - `projects//locations//agent/versions/` - */ - // const name = 'abc123' - - // Imports the Dialogflow library - const {VersionsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new VersionsClient(); - - async function callGetVersion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dialogflowClient.getVersion(request); - console.log(response); - } - - callGetVersion(); - // [END dialogflow_v2beta1_generated_Versions_GetVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.list_versions.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.list_versions.js deleted file mode 100644 index 1e1c949724f..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.list_versions.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2022 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'; - -function main(parent) { - // [START dialogflow_v2beta1_generated_Versions_ListVersions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The agent to list all versions from. - * Supported formats: - * - `projects//agent` - * - `projects//locations//agent` - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of items to return in a single page. By default 100 and - * at most 1000. - */ - // const pageSize = 1234 - /** - * Optional. The next_page_token value returned from a previous list request. - */ - // const pageToken = 'abc123' - - // Imports the Dialogflow library - const {VersionsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new VersionsClient(); - - async function callListVersions() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await dialogflowClient.listVersionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListVersions(); - // [END dialogflow_v2beta1_generated_Versions_ListVersions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.update_version.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.update_version.js deleted file mode 100644 index fe66dcd53e4..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/samples/generated/v2beta1/versions.update_version.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2022 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'; - -function main(version, updateMask) { - // [START dialogflow_v2beta1_generated_Versions_UpdateVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The version to update. - * Supported formats: - * - `projects//agent/versions/` - * - `projects//locations//agent/versions/` - */ - // const version = {} - /** - * Required. The mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dialogflow library - const {VersionsClient} = require('@google-cloud/dialogflow').v2beta1; - - // Instantiates a client - const dialogflowClient = new VersionsClient(); - - async function callUpdateVersion() { - // Construct request - const request = { - version, - updateMask, - }; - - // Run request - const response = await dialogflowClient.updateVersion(request); - console.log(response); - } - - callUpdateVersion(); - // [END dialogflow_v2beta1_generated_Versions_UpdateVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/index.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/index.ts deleted file mode 100644 index df3fdc37b98..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/index.ts +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2022 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/google-cloud-dialogflow/v2beta1/src/v2beta1/agents_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/agents_client.ts deleted file mode 100644 index 5d436e0d5f3..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/agents_client.ts +++ /dev/null @@ -1,3414 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -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'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new AgentsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2beta1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2beta1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2beta1/{name=projects/*/operations/*}:cancel',additional_bindings: [{post: '/v2beta1/{name=projects/*/locations/*/operations/*}:cancel',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2beta1/{name=projects/*/operations/*}',additional_bindings: [{get: '/v2beta1/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2beta1/{name=projects/*}/operations',additional_bindings: [{get: '/v2beta1/{name=projects/*/locations/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).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 = this._gaxModule.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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2beta1/agents.get_agent.js - * region_tag:dialogflow_v2beta1_generated_Agents_GetAgent_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.getAgent(request, options, callback); - } -/** - * 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.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 include:samples/generated/v2beta1/agents.set_agent.js - * region_tag:dialogflow_v2beta1_generated_Agents_SetAgent_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'agent.parent': request.agent!.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.setAgent(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/agents.delete_agent.js - * region_tag:dialogflow_v2beta1_generated_Agents_DeleteAgent_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteAgent(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/agents.get_validation_result.js - * region_tag:dialogflow_v2beta1_generated_Agents_GetValidationResult_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.getValidationResult(request, options, callback); - } - -/** - * Trains the specified agent. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: An empty [Struct - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - * - `response`: An [Empty - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - * - * 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/` 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 include:samples/generated/v2beta1/agents.train_agent.js - * region_tag:dialogflow_v2beta1_generated_Agents_TrainAgent_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2beta1/agents.train_agent.js - * region_tag:dialogflow_v2beta1_generated_Agents_TrainAgent_async - */ - async checkTrainAgentProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.trainAgent, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Exports the specified agent to a ZIP file. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: An empty [Struct - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - * - `response`: {@link google.cloud.dialogflow.v2beta1.ExportAgentResponse|ExportAgentResponse} - * - * @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. - * - * Dialogflow performs a write operation for the Cloud Storage object - * on the caller's behalf, so your request authentication must - * have write permissions for the object. For more information, see - * [Dialogflow access - * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2beta1/agents.export_agent.js - * region_tag:dialogflow_v2beta1_generated_Agents_ExportAgent_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2beta1/agents.export_agent.js - * region_tag:dialogflow_v2beta1_generated_Agents_ExportAgent_async - */ - async checkExportAgentProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportAgent, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * 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. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: An empty [Struct - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - * - `response`: An [Empty - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - * - * The operation only tracks when importing is complete, 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/` 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://". - * - * Dialogflow performs a read operation for the Cloud Storage object - * on the caller's behalf, so your request authentication must - * have read permissions for the object. For more information, see - * [Dialogflow access - * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). - * @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 include:samples/generated/v2beta1/agents.import_agent.js - * region_tag:dialogflow_v2beta1_generated_Agents_ImportAgent_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2beta1/agents.import_agent.js - * region_tag:dialogflow_v2beta1_generated_Agents_ImportAgent_async - */ - async checkImportAgentProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importAgent, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * 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. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: An empty [Struct - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - * - `response`: An [Empty - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - * - * The operation only tracks when restoring is complete, 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/` 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://". - * - * Dialogflow performs a read operation for the Cloud Storage object - * on the caller's behalf, so your request authentication must - * have read permissions for the object. For more information, see - * [Dialogflow access - * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). - * @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 include:samples/generated/v2beta1/agents.restore_agent.js - * region_tag:dialogflow_v2beta1_generated_Agents_RestoreAgent_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2beta1/agents.restore_agent.js - * region_tag:dialogflow_v2beta1_generated_Agents_RestoreAgent_async - */ - async checkRestoreAgentProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.restoreAgent, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['searchAgents']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.searchAgents.createStream( - this.innerApiCalls.searchAgents as 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 include:samples/generated/v2beta1/agents.search_agents.js - * region_tag:dialogflow_v2beta1_generated_Agents_SearchAgents_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['searchAgents']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.searchAgents.asyncIterate( - this.innerApiCalls['searchAgents'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. The promise has a method named - * "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- 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 { - if (this.agentsStub && !this._terminated) { - return this.agentsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/agents_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/agents_client_config.json deleted file mode 100644 index b73a09e593a..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/agents_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/agents_proto_list.json deleted file mode 100644 index cb5136f11dc..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/answer_records_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/answer_records_client.ts deleted file mode 100644 index e8edd8274e0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/answer_records_client.ts +++ /dev/null @@ -1,2577 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new AnswerRecordsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = this._gaxModule.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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2beta1/answer_records.get_answer_record.js - * region_tag:dialogflow_v2beta1_generated_AnswerRecords_GetAnswerRecord_async - * @deprecated GetAnswerRecord is deprecated and may be removed in a future version. - */ - 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; - 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' - ] = this._gaxModule.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); - } -/** - * 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 include:samples/generated/v2beta1/answer_records.update_answer_record.js - * region_tag:dialogflow_v2beta1_generated_AnswerRecords_UpdateAnswerRecord_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'answer_record.name': request.answerRecord!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateAnswerRecord(request, options, callback); - } - - /** - * 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] - * Optional. Filters to restrict results to specific answer records. - * - * 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.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, - 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; - 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' - ] = this._gaxModule.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] - * Optional. Filters to restrict results to specific answer records. - * - * 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.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listAnswerRecords']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAnswerRecords.createStream( - this.innerApiCalls.listAnswerRecords as 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] - * Optional. Filters to restrict results to specific answer records. - * - * 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.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 include:samples/generated/v2beta1/answer_records.list_answer_records.js - * region_tag:dialogflow_v2beta1_generated_AnswerRecords_ListAnswerRecords_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listAnswerRecords']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAnswerRecords.asyncIterate( - this.innerApiCalls['listAnswerRecords'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- 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 { - if (this.answerRecordsStub && !this._terminated) { - return this.answerRecordsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/answer_records_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/answer_records_client_config.json deleted file mode 100644 index 34e2ae76e6c..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/answer_records_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/answer_records_proto_list.json deleted file mode 100644 index cb5136f11dc..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/contexts_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/contexts_client.ts deleted file mode 100644 index daeda03c23b..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/contexts_client.ts +++ /dev/null @@ -1,2880 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new ContextsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = this._gaxModule.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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2beta1/contexts.get_context.js - * region_tag:dialogflow_v2beta1_generated_Contexts_GetContext_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getContext(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/contexts.create_context.js - * region_tag:dialogflow_v2beta1_generated_Contexts_CreateContext_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createContext(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/contexts.update_context.js - * region_tag:dialogflow_v2beta1_generated_Contexts_UpdateContext_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'context.name': request.context!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateContext(request, options, callback); - } -/** - * Deletes the specified context. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the context to delete. 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 include:samples/generated/v2beta1/contexts.delete_context.js - * region_tag:dialogflow_v2beta1_generated_Contexts_DeleteContext_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteContext(request, options, callback); - } -/** - * Deletes all active contexts in the specified session. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the session to delete all contexts from. 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 include:samples/generated/v2beta1/contexts.delete_all_contexts.js - * region_tag:dialogflow_v2beta1_generated_Contexts_DeleteAllContexts_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteAllContexts(request, options, callback); - } - - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listContexts']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listContexts.createStream( - this.innerApiCalls.listContexts as 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 include:samples/generated/v2beta1/contexts.list_contexts.js - * region_tag:dialogflow_v2beta1_generated_Contexts_ListContexts_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listContexts']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listContexts.asyncIterate( - this.innerApiCalls['listContexts'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- 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 { - if (this.contextsStub && !this._terminated) { - return this.contextsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/contexts_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/contexts_client_config.json deleted file mode 100644 index d9e5c1a5b97..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/contexts_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/contexts_proto_list.json deleted file mode 100644 index cb5136f11dc..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/conversation_profiles_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversation_profiles_client.ts deleted file mode 100644 index 00ed24cd614..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversation_profiles_client.ts +++ /dev/null @@ -1,3185 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -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}; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new ConversationProfilesClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = { - cXSecuritySettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/securitySettings/{security_settings}' - ), - 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') - }; - - 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. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2beta1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2beta1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2beta1/{name=projects/*/operations/*}:cancel',additional_bindings: [{post: '/v2beta1/{name=projects/*/locations/*/operations/*}:cancel',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2beta1/{name=projects/*/operations/*}',additional_bindings: [{get: '/v2beta1/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2beta1/{name=projects/*}/operations',additional_bindings: [{get: '/v2beta1/{name=projects/*/locations/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const setSuggestionFeatureConfigResponse = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2beta1.ConversationProfile') as gax.protobuf.Type; - const setSuggestionFeatureConfigMetadata = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata') as gax.protobuf.Type; - const clearSuggestionFeatureConfigResponse = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2beta1.ConversationProfile') as gax.protobuf.Type; - const clearSuggestionFeatureConfigMetadata = protoFilesRoot.lookup( - '.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - setSuggestionFeatureConfig: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - setSuggestionFeatureConfigResponse.decode.bind(setSuggestionFeatureConfigResponse), - setSuggestionFeatureConfigMetadata.decode.bind(setSuggestionFeatureConfigMetadata)), - clearSuggestionFeatureConfig: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - clearSuggestionFeatureConfigResponse.decode.bind(clearSuggestionFeatureConfigResponse), - clearSuggestionFeatureConfigMetadata.decode.bind(clearSuggestionFeatureConfigMetadata)) - }; - - // 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 = this._gaxModule.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', 'setSuggestionFeatureConfig', 'clearSuggestionFeatureConfig']; - 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] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2beta1/conversation_profiles.get_conversation_profile.js - * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_GetConversationProfile_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getConversationProfile(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/conversation_profiles.create_conversation_profile.js - * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_CreateConversationProfile_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createConversationProfile(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/conversation_profiles.update_conversation_profile.js - * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_UpdateConversationProfile_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'conversation_profile.name': request.conversationProfile!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateConversationProfile(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/conversation_profiles.delete_conversation_profile.js - * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_DeleteConversationProfile_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteConversationProfile(request, options, callback); - } - -/** - * Adds or updates a suggestion feature in a conversation profile. - * If the conversation profile contains the type of suggestion feature for - * the participant role, it will update it. Otherwise it will insert the - * suggestion feature. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: {@link google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata|SetSuggestionFeatureConfigOperationMetadata} - * - `response`: {@link google.cloud.dialogflow.v2beta1.ConversationProfile|ConversationProfile} - * - * If a long running operation to add or update suggestion feature - * config for the same conversation profile, participant role and suggestion - * feature type exists, please cancel the existing long running operation - * before sending such request, otherwise the request will be rejected. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.conversationProfile - * Required. The Conversation Profile to add or update the suggestion feature - * config. Format: `projects//locations//conversationProfiles/`. - * @param {google.cloud.dialogflow.v2beta1.Participant.Role} request.participantRole - * Required. The participant role to add or update the suggestion feature - * config. Only HUMAN_AGENT or END_USER can be used. - * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig} request.suggestionFeatureConfig - * Required. The suggestion feature config to add or 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 - * 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 include:samples/generated/v2beta1/conversation_profiles.set_suggestion_feature_config.js - * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_SetSuggestionFeatureConfig_async - */ - setSuggestionFeatureConfig( - request?: protos.google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - setSuggestionFeatureConfig( - request: protos.google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - setSuggestionFeatureConfig( - request: protos.google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - setSuggestionFeatureConfig( - request?: protos.google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigRequest, - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'conversation_profile': request.conversationProfile ?? '', - }); - this.initialize(); - return this.innerApiCalls.setSuggestionFeatureConfig(request, options, callback); - } -/** - * Check the status of the long running operation returned by `setSuggestionFeatureConfig()`. - * @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 include:samples/generated/v2beta1/conversation_profiles.set_suggestion_feature_config.js - * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_SetSuggestionFeatureConfig_async - */ - async checkSetSuggestionFeatureConfigProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.setSuggestionFeatureConfig, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Clears a suggestion feature from a conversation profile for the given - * participant role. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: {@link google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata|ClearSuggestionFeatureConfigOperationMetadata} - * - `response`: {@link google.cloud.dialogflow.v2beta1.ConversationProfile|ConversationProfile} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.conversationProfile - * Required. The Conversation Profile to add or update the suggestion feature - * config. Format: `projects//locations//conversationProfiles/`. - * @param {google.cloud.dialogflow.v2beta1.Participant.Role} request.participantRole - * Required. The participant role to remove the suggestion feature - * config. Only HUMAN_AGENT or END_USER can be used. - * @param {google.cloud.dialogflow.v2beta1.SuggestionFeature.Type} request.suggestionFeatureType - * Required. The type of the suggestion feature to remove. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2beta1/conversation_profiles.clear_suggestion_feature_config.js - * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async - */ - clearSuggestionFeatureConfig( - request?: protos.google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - clearSuggestionFeatureConfig( - request: protos.google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - clearSuggestionFeatureConfig( - request: protos.google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - clearSuggestionFeatureConfig( - request?: protos.google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigRequest, - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'conversation_profile': request.conversationProfile ?? '', - }); - this.initialize(); - return this.innerApiCalls.clearSuggestionFeatureConfig(request, options, callback); - } -/** - * Check the status of the long running operation returned by `clearSuggestionFeatureConfig()`. - * @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 include:samples/generated/v2beta1/conversation_profiles.clear_suggestion_feature_config.js - * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async - */ - async checkClearSuggestionFeatureConfigProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.clearSuggestionFeatureConfig, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listConversationProfiles']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConversationProfiles.createStream( - this.innerApiCalls.listConversationProfiles as 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 include:samples/generated/v2beta1/conversation_profiles.list_conversation_profiles.js - * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_ListConversationProfiles_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listConversationProfiles']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConversationProfiles.asyncIterate( - this.innerApiCalls['listConversationProfiles'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. The promise has a method named - * "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified cXSecuritySettings resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} security_settings - * @returns {string} Resource name string. - */ - cXSecuritySettingsPath(project:string,location:string,securitySettings:string) { - return this.pathTemplates.cXSecuritySettingsPathTemplate.render({ - project: project, - location: location, - security_settings: securitySettings, - }); - } - - /** - * Parse the project from CXSecuritySettings resource. - * - * @param {string} cXSecuritySettingsName - * A fully-qualified path representing CXSecuritySettings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCXSecuritySettingsName(cXSecuritySettingsName: string) { - return this.pathTemplates.cXSecuritySettingsPathTemplate.match(cXSecuritySettingsName).project; - } - - /** - * Parse the location from CXSecuritySettings resource. - * - * @param {string} cXSecuritySettingsName - * A fully-qualified path representing CXSecuritySettings resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCXSecuritySettingsName(cXSecuritySettingsName: string) { - return this.pathTemplates.cXSecuritySettingsPathTemplate.match(cXSecuritySettingsName).location; - } - - /** - * Parse the security_settings from CXSecuritySettings resource. - * - * @param {string} cXSecuritySettingsName - * A fully-qualified path representing CXSecuritySettings resource. - * @returns {string} A string representing the security_settings. - */ - matchSecuritySettingsFromCXSecuritySettingsName(cXSecuritySettingsName: string) { - return this.pathTemplates.cXSecuritySettingsPathTemplate.match(cXSecuritySettingsName).security_settings; - } - - /** - * 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 { - if (this.conversationProfilesStub && !this._terminated) { - return this.conversationProfilesStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversation_profiles_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversation_profiles_client_config.json deleted file mode 100644 index 080a39ac373..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversation_profiles_client_config.json +++ /dev/null @@ -1,64 +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" - }, - "SetSuggestionFeatureConfig": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "ClearSuggestionFeatureConfig": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversation_profiles_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversation_profiles_proto_list.json deleted file mode 100644 index cb5136f11dc..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/conversations_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversations_client.ts deleted file mode 100644 index 32746ba5051..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversations_client.ts +++ /dev/null @@ -1,3079 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new ConversationsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = this._gaxModule.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', 'suggestConversationSummary']; - 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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2beta1/conversations.create_conversation.js - * region_tag:dialogflow_v2beta1_generated_Conversations_CreateConversation_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createConversation(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/conversations.get_conversation.js - * region_tag:dialogflow_v2beta1_generated_Conversations_GetConversation_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getConversation(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/conversations.complete_conversation.js - * region_tag:dialogflow_v2beta1_generated_Conversations_CompleteConversation_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.completeConversation(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/conversations.batch_create_messages.js - * region_tag:dialogflow_v2beta1_generated_Conversations_BatchCreateMessages_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.batchCreateMessages(request, options, callback); - } -/** - * Suggest summary for a conversation based on specific historical messages. - * The range of the messages to be used for summary can be specified in the - * request. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.conversation - * Required. The conversation to fetch suggestion for. - * Format: `projects//locations//conversations/`. - * @param {string} request.latestMessage - * The name of the latest conversation message used as context for - * compiling suggestion. If empty, the latest message of the conversation will - * be used. - * - * 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 500 and at most 1000. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [SuggestConversationSummaryResponse]{@link google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v2beta1/conversations.suggest_conversation_summary.js - * region_tag:dialogflow_v2beta1_generated_Conversations_SuggestConversationSummary_async - */ - suggestConversationSummary( - request?: protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse, - protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest|undefined, {}|undefined - ]>; - suggestConversationSummary( - request: protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse, - protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest|null|undefined, - {}|null|undefined>): void; - suggestConversationSummary( - request: protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest, - callback: Callback< - protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse, - protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest|null|undefined, - {}|null|undefined>): void; - suggestConversationSummary( - request?: protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse, - protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse, - protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse, - protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'conversation': request.conversation ?? '', - }); - this.initialize(); - return this.innerApiCalls.suggestConversationSummary(request, options, callback); - } - - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listConversations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConversations.createStream( - this.innerApiCalls.listConversations as 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 include:samples/generated/v2beta1/conversations.list_conversations.js - * region_tag:dialogflow_v2beta1_generated_Conversations_ListConversations_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listConversations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConversations.asyncIterate( - this.innerApiCalls['listConversations'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listMessages']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMessages.createStream( - this.innerApiCalls.listMessages as 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 include:samples/generated/v2beta1/conversations.list_messages.js - * region_tag:dialogflow_v2beta1_generated_Conversations_ListMessages_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listMessages']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMessages.asyncIterate( - this.innerApiCalls['listMessages'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- 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 { - if (this.conversationsStub && !this._terminated) { - return this.conversationsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversations_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversations_client_config.json deleted file mode 100644 index 62968c0bd5e..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversations_client_config.json +++ /dev/null @@ -1,64 +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" - }, - "SuggestConversationSummary": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversations_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/conversations_proto_list.json deleted file mode 100644 index cb5136f11dc..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/documents_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/documents_client.ts deleted file mode 100644 index 4530b779da0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/documents_client.ts +++ /dev/null @@ -1,3331 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -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'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new DocumentsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2beta1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2beta1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2beta1/{name=projects/*/operations/*}:cancel',additional_bindings: [{post: '/v2beta1/{name=projects/*/locations/*/operations/*}:cancel',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2beta1/{name=projects/*/operations/*}',additional_bindings: [{get: '/v2beta1/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2beta1/{name=projects/*}/operations',additional_bindings: [{get: '/v2beta1/{name=projects/*/locations/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).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 = this._gaxModule.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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2beta1/documents.get_document.js - * region_tag:dialogflow_v2beta1_generated_Documents_GetDocument_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getDocument(request, options, callback); - } - -/** - * Creates a new document. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: {@link google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata|KnowledgeOperationMetadata} - * - `response`: {@link google.cloud.dialogflow.v2beta1.Document|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 include:samples/generated/v2beta1/documents.create_document.js - * region_tag:dialogflow_v2beta1_generated_Documents_CreateDocument_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2beta1/documents.create_document.js - * region_tag:dialogflow_v2beta1_generated_Documents_CreateDocument_async - */ - async checkCreateDocumentProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createDocument, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * 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. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: {@link google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata|KnowledgeOperationMetadata} - * - `response`: {@link google.cloud.dialogflow.v2beta1.ImportDocumentsResponse|ImportDocumentsResponse} - * - * @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 include:samples/generated/v2beta1/documents.import_documents.js - * region_tag:dialogflow_v2beta1_generated_Documents_ImportDocuments_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2beta1/documents.import_documents.js - * region_tag:dialogflow_v2beta1_generated_Documents_ImportDocuments_async - */ - async checkImportDocumentsProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importDocuments, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes the specified document. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: {@link google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata|KnowledgeOperationMetadata} - * - `response`: An [Empty - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - * - * 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 include:samples/generated/v2beta1/documents.delete_document.js - * region_tag:dialogflow_v2beta1_generated_Documents_DeleteDocument_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2beta1/documents.delete_document.js - * region_tag:dialogflow_v2beta1_generated_Documents_DeleteDocument_async - */ - async checkDeleteDocumentProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteDocument, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the specified document. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: {@link google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata|KnowledgeOperationMetadata} - * - `response`: {@link google.cloud.dialogflow.v2beta1.Document|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 include:samples/generated/v2beta1/documents.update_document.js - * region_tag:dialogflow_v2beta1_generated_Documents_UpdateDocument_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2beta1/documents.update_document.js - * region_tag:dialogflow_v2beta1_generated_Documents_UpdateDocument_async - */ - async checkUpdateDocumentProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateDocument, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * 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. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: {@link google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata|KnowledgeOperationMetadata} - * - `response`: {@link google.cloud.dialogflow.v2beta1.Document|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 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 include:samples/generated/v2beta1/documents.reload_document.js - * region_tag:dialogflow_v2beta1_generated_Documents_ReloadDocument_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2beta1/documents.reload_document.js - * region_tag:dialogflow_v2beta1_generated_Documents_ReloadDocument_async - */ - async checkReloadDocumentProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.reloadDocument, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listDocuments']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDocuments.createStream( - this.innerApiCalls.listDocuments as 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 include:samples/generated/v2beta1/documents.list_documents.js - * region_tag:dialogflow_v2beta1_generated_Documents_ListDocuments_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listDocuments']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listDocuments.asyncIterate( - this.innerApiCalls['listDocuments'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. The promise has a method named - * "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- 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 { - if (this.documentsStub && !this._terminated) { - return this.documentsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/documents_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/documents_client_config.json deleted file mode 100644 index 994669432ce..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/documents_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/documents_proto_list.json deleted file mode 100644 index cb5136f11dc..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/entity_types_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/entity_types_client.ts deleted file mode 100644 index f263eebf17e..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/entity_types_client.ts +++ /dev/null @@ -1,3575 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -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'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new EntityTypesClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2beta1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2beta1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2beta1/{name=projects/*/operations/*}:cancel',additional_bindings: [{post: '/v2beta1/{name=projects/*/locations/*/operations/*}:cancel',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2beta1/{name=projects/*/operations/*}',additional_bindings: [{get: '/v2beta1/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2beta1/{name=projects/*}/operations',additional_bindings: [{get: '/v2beta1/{name=projects/*/locations/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).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 = this._gaxModule.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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2beta1/entity_types.get_entity_type.js - * region_tag:dialogflow_v2beta1_generated_EntityTypes_GetEntityType_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getEntityType(request, options, callback); - } -/** - * 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. - * 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 include:samples/generated/v2beta1/entity_types.create_entity_type.js - * region_tag:dialogflow_v2beta1_generated_EntityTypes_CreateEntityType_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createEntityType(request, options, callback); - } -/** - * 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.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 include:samples/generated/v2beta1/entity_types.update_entity_type.js - * region_tag:dialogflow_v2beta1_generated_EntityTypes_UpdateEntityType_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'entity_type.name': request.entityType!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateEntityType(request, options, callback); - } -/** - * 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. - * 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 include:samples/generated/v2beta1/entity_types.delete_entity_type.js - * region_tag:dialogflow_v2beta1_generated_EntityTypes_DeleteEntityType_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteEntityType(request, options, callback); - } - -/** - * Updates/Creates multiple entity types in the specified agent. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: An empty [Struct - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - * - `response`: {@link google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse|BatchUpdateEntityTypesResponse} - * - * 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. - * 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 include:samples/generated/v2beta1/entity_types.batch_update_entity_types.js - * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntityTypes_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2beta1/entity_types.batch_update_entity_types.js - * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntityTypes_async - */ - async checkBatchUpdateEntityTypesProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchUpdateEntityTypes, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes entity types in the specified agent. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: An empty [Struct - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - * - `response`: An [Empty - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - * - * 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. - * 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 include:samples/generated/v2beta1/entity_types.batch_delete_entity_types.js - * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntityTypes_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2beta1/entity_types.batch_delete_entity_types.js - * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntityTypes_async - */ - async checkBatchDeleteEntityTypesProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchDeleteEntityTypes, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates multiple new entities in the specified entity type. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: An empty [Struct - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - * - `response`: An [Empty - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - * - * 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. - * 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 include:samples/generated/v2beta1/entity_types.batch_create_entities.js - * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchCreateEntities_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2beta1/entity_types.batch_create_entities.js - * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchCreateEntities_async - */ - async checkBatchCreateEntitiesProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchCreateEntities, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * 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). - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: An empty [Struct - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - * - `response`: An [Empty - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - * - * @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 include:samples/generated/v2beta1/entity_types.batch_update_entities.js - * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntities_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2beta1/entity_types.batch_update_entities.js - * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntities_async - */ - async checkBatchUpdateEntitiesProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchUpdateEntities, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes entities in the specified entity type. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: An empty [Struct - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - * - `response`: An [Empty - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - * - * 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. - * 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 include:samples/generated/v2beta1/entity_types.batch_delete_entities.js - * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntities_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2beta1/entity_types.batch_delete_entities.js - * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntities_async - */ - async checkBatchDeleteEntitiesProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchDeleteEntities, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listEntityTypes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listEntityTypes.createStream( - this.innerApiCalls.listEntityTypes as 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 include:samples/generated/v2beta1/entity_types.list_entity_types.js - * region_tag:dialogflow_v2beta1_generated_EntityTypes_ListEntityTypes_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listEntityTypes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listEntityTypes.asyncIterate( - this.innerApiCalls['listEntityTypes'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. The promise has a method named - * "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- 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 { - if (this.entityTypesStub && !this._terminated) { - return this.entityTypesStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/entity_types_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/entity_types_client_config.json deleted file mode 100644 index 987e4260c42..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/entity_types_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/entity_types_proto_list.json deleted file mode 100644 index cb5136f11dc..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/environments_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/environments_client.ts deleted file mode 100644 index a850a020330..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/environments_client.ts +++ /dev/null @@ -1,2910 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new EnvironmentsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = this._gaxModule.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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2beta1/environments.get_environment.js - * region_tag:dialogflow_v2beta1_generated_Environments_GetEnvironment_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getEnvironment(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/environments.create_environment.js - * region_tag:dialogflow_v2beta1_generated_Environments_CreateEnvironment_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createEnvironment(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/environments.update_environment.js - * region_tag:dialogflow_v2beta1_generated_Environments_UpdateEnvironment_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'environment.name': request.environment!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateEnvironment(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/environments.delete_environment.js - * region_tag:dialogflow_v2beta1_generated_Environments_DeleteEnvironment_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteEnvironment(request, options, callback); - } - - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listEnvironments']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listEnvironments.createStream( - this.innerApiCalls.listEnvironments as 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 include:samples/generated/v2beta1/environments.list_environments.js - * region_tag:dialogflow_v2beta1_generated_Environments_ListEnvironments_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listEnvironments']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listEnvironments.asyncIterate( - this.innerApiCalls['listEnvironments'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['getEnvironmentHistory']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.getEnvironmentHistory.createStream( - this.innerApiCalls.getEnvironmentHistory as 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 include:samples/generated/v2beta1/environments.get_environment_history.js - * region_tag:dialogflow_v2beta1_generated_Environments_GetEnvironmentHistory_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['getEnvironmentHistory']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.getEnvironmentHistory.asyncIterate( - this.innerApiCalls['getEnvironmentHistory'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- 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 { - if (this.environmentsStub && !this._terminated) { - return this.environmentsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/environments_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/environments_client_config.json deleted file mode 100644 index 4fd9caa5715..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/environments_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/environments_proto_list.json deleted file mode 100644 index cb5136f11dc..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/fulfillments_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/fulfillments_client.ts deleted file mode 100644 index 5f88080719a..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/fulfillments_client.ts +++ /dev/null @@ -1,2332 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} 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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new FulfillmentsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = this._gaxModule.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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2beta1/fulfillments.get_fulfillment.js - * region_tag:dialogflow_v2beta1_generated_Fulfillments_GetFulfillment_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getFulfillment(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/fulfillments.update_fulfillment.js - * region_tag:dialogflow_v2beta1_generated_Fulfillments_UpdateFulfillment_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'fulfillment.name': request.fulfillment!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateFulfillment(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, 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 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 { - if (this.fulfillmentsStub && !this._terminated) { - return this.fulfillmentsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/fulfillments_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/fulfillments_client_config.json deleted file mode 100644 index b865673e9f2..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/fulfillments_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/fulfillments_proto_list.json deleted file mode 100644 index cb5136f11dc..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/gapic_metadata.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/gapic_metadata.json deleted file mode 100644 index 9e1a852b6ec..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/gapic_metadata.json +++ /dev/null @@ -1,1193 +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" - ] - }, - "SetSuggestionFeatureConfig": { - "methods": [ - "setSuggestionFeatureConfig" - ] - }, - "ClearSuggestionFeatureConfig": { - "methods": [ - "clearSuggestionFeatureConfig" - ] - }, - "ListConversationProfiles": { - "methods": [ - "listConversationProfiles", - "listConversationProfilesStream", - "listConversationProfilesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ConversationProfilesClient", - "rpcs": { - "GetConversationProfile": { - "methods": [ - "getConversationProfile" - ] - }, - "CreateConversationProfile": { - "methods": [ - "createConversationProfile" - ] - }, - "UpdateConversationProfile": { - "methods": [ - "updateConversationProfile" - ] - }, - "DeleteConversationProfile": { - "methods": [ - "deleteConversationProfile" - ] - }, - "SetSuggestionFeatureConfig": { - "methods": [ - "setSuggestionFeatureConfig" - ] - }, - "ClearSuggestionFeatureConfig": { - "methods": [ - "clearSuggestionFeatureConfig" - ] - }, - "ListConversationProfiles": { - "methods": [ - "listConversationProfiles", - "listConversationProfilesStream", - "listConversationProfilesAsync" - ] - } - } - } - } - }, - "Conversations": { - "clients": { - "grpc": { - "libraryClient": "ConversationsClient", - "rpcs": { - "CreateConversation": { - "methods": [ - "createConversation" - ] - }, - "GetConversation": { - "methods": [ - "getConversation" - ] - }, - "CompleteConversation": { - "methods": [ - "completeConversation" - ] - }, - "BatchCreateMessages": { - "methods": [ - "batchCreateMessages" - ] - }, - "SuggestConversationSummary": { - "methods": [ - "suggestConversationSummary" - ] - }, - "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" - ] - }, - "SuggestConversationSummary": { - "methods": [ - "suggestConversationSummary" - ] - }, - "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" - ] - }, - "StreamingAnalyzeContent": { - "methods": [ - "streamingAnalyzeContent" - ] - }, - "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/google-cloud-dialogflow/v2beta1/src/v2beta1/index.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/index.ts deleted file mode 100644 index d11d0540360..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/index.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 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/google-cloud-dialogflow/v2beta1/src/v2beta1/intents_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/intents_client.ts deleted file mode 100644 index 8b507401c79..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/intents_client.ts +++ /dev/null @@ -1,3233 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -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'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new IntentsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v2beta1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v2beta1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v2beta1/{name=projects/*/operations/*}:cancel',additional_bindings: [{post: '/v2beta1/{name=projects/*/locations/*/operations/*}:cancel',}], - },{selector: 'google.longrunning.Operations.GetOperation',get: '/v2beta1/{name=projects/*/operations/*}',additional_bindings: [{get: '/v2beta1/{name=projects/*/locations/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2beta1/{name=projects/*}/operations',additional_bindings: [{get: '/v2beta1/{name=projects/*/locations/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).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 = this._gaxModule.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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2beta1/intents.get_intent.js - * region_tag:dialogflow_v2beta1_generated_Intents_GetIntent_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getIntent(request, options, callback); - } -/** - * 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. - * 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 include:samples/generated/v2beta1/intents.create_intent.js - * region_tag:dialogflow_v2beta1_generated_Intents_CreateIntent_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createIntent(request, options, callback); - } -/** - * 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.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 include:samples/generated/v2beta1/intents.update_intent.js - * region_tag:dialogflow_v2beta1_generated_Intents_UpdateIntent_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'intent.name': request.intent!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateIntent(request, options, callback); - } -/** - * 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. - * - * 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 include:samples/generated/v2beta1/intents.delete_intent.js - * region_tag:dialogflow_v2beta1_generated_Intents_DeleteIntent_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteIntent(request, options, callback); - } - -/** - * Updates/Creates multiple intents in the specified agent. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: An empty [Struct - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - * - `response`: {@link google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse|BatchUpdateIntentsResponse} - * - * 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. - * 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 include:samples/generated/v2beta1/intents.batch_update_intents.js - * region_tag:dialogflow_v2beta1_generated_Intents_BatchUpdateIntents_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2beta1/intents.batch_update_intents.js - * region_tag:dialogflow_v2beta1_generated_Intents_BatchUpdateIntents_async - */ - async checkBatchUpdateIntentsProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchUpdateIntents, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes intents in the specified agent. - * - * This method is a [long-running - * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). - * The returned `Operation` type has the following method-specific fields: - * - * - `metadata`: An empty [Struct - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - * - `response`: An [Empty - * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) - * - * 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. - * 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 include:samples/generated/v2beta1/intents.batch_delete_intents.js - * region_tag:dialogflow_v2beta1_generated_Intents_BatchDeleteIntents_async - */ - 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; - 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' - ] = this._gaxModule.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 include:samples/generated/v2beta1/intents.batch_delete_intents.js - * region_tag:dialogflow_v2beta1_generated_Intents_BatchDeleteIntents_async - */ - async checkBatchDeleteIntentsProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchDeleteIntents, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listIntents']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listIntents.createStream( - this.innerApiCalls.listIntents as 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 include:samples/generated/v2beta1/intents.list_intents.js - * region_tag:dialogflow_v2beta1_generated_Intents_ListIntents_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listIntents']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listIntents.asyncIterate( - this.innerApiCalls['listIntents'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. The promise has a method named - * "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- 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 { - if (this.intentsStub && !this._terminated) { - return this.intentsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/intents_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/intents_client_config.json deleted file mode 100644 index 7f297576fb1..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/intents_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/intents_proto_list.json deleted file mode 100644 index cb5136f11dc..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/knowledge_bases_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/knowledge_bases_client.ts deleted file mode 100644 index 588c7e60c03..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/knowledge_bases_client.ts +++ /dev/null @@ -1,2791 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new KnowledgeBasesClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = this._gaxModule.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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2beta1/knowledge_bases.get_knowledge_base.js - * region_tag:dialogflow_v2beta1_generated_KnowledgeBases_GetKnowledgeBase_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getKnowledgeBase(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/knowledge_bases.create_knowledge_base.js - * region_tag:dialogflow_v2beta1_generated_KnowledgeBases_CreateKnowledgeBase_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createKnowledgeBase(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/knowledge_bases.delete_knowledge_base.js - * region_tag:dialogflow_v2beta1_generated_KnowledgeBases_DeleteKnowledgeBase_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteKnowledgeBase(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/knowledge_bases.update_knowledge_base.js - * region_tag:dialogflow_v2beta1_generated_KnowledgeBases_UpdateKnowledgeBase_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'knowledge_base.name': request.knowledgeBase!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateKnowledgeBase(request, options, callback); - } - - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listKnowledgeBases']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listKnowledgeBases.createStream( - this.innerApiCalls.listKnowledgeBases as 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 include:samples/generated/v2beta1/knowledge_bases.list_knowledge_bases.js - * region_tag:dialogflow_v2beta1_generated_KnowledgeBases_ListKnowledgeBases_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listKnowledgeBases']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listKnowledgeBases.asyncIterate( - this.innerApiCalls['listKnowledgeBases'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- 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 { - if (this.knowledgeBasesStub && !this._terminated) { - return this.knowledgeBasesStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/knowledge_bases_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/knowledge_bases_client_config.json deleted file mode 100644 index f563adcead4..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/knowledge_bases_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/knowledge_bases_proto_list.json deleted file mode 100644 index cb5136f11dc..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/participants_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/participants_client.ts deleted file mode 100644 index 60b5182268c..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/participants_client.ts +++ /dev/null @@ -1,3398 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform, PassThrough} from 'stream'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new ParticipantsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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') - }; - - // Some of the methods on this service provide streaming responses. - // Provide descriptors for these. - this.descriptors.stream = { - streamingAnalyzeContent: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, opts.fallback === 'rest') - }; - - // 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 = this._gaxModule.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', 'streamingAnalyzeContent', 'suggestArticles', 'suggestFaqAnswers', 'suggestSmartReplies', 'listSuggestions', 'compileSuggestion']; - for (const methodName of participantsStubMethods) { - const callPromise = this.participantsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough(); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; - } - 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.stream[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2beta1/participants.create_participant.js - * region_tag:dialogflow_v2beta1_generated_Participants_CreateParticipant_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createParticipant(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/participants.get_participant.js - * region_tag:dialogflow_v2beta1_generated_Participants_GetParticipant_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getParticipant(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/participants.update_participant.js - * region_tag:dialogflow_v2beta1_generated_Participants_UpdateParticipant_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'participant.name': request.participant!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateParticipant(request, options, callback); - } -/** - * 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.AudioInput} request.audioInput - * The natural language speech audio 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.cloud.dialogflow.v2beta1.AssistQueryParameters} request.assistQueryParams - * Parameters for a human assist query. - * @param {google.protobuf.Struct} request.cxParameters - * Additional parameters to be put into Dialogflow CX session parameters. To - * remove a parameter from the session, clients should explicitly set the - * parameter value to null. - * - * Note: this field should only be used if you are connecting to a Dialogflow - * CX agent. - * @param {string} request.cxCurrentPage - * The unique identifier of the CX page to override the `current_page` in the - * session. - * Format: `projects//locations//agents//flows//pages/`. - * - * If `cx_current_page` is specified, the previous state of the session will - * be ignored by Dialogflow CX, including the [previous - * page][QueryResult.current_page] and the [previous session - * parameters][QueryResult.parameters]. In most cases, `cx_current_page` and - * `cx_parameters` should be configured together to direct a session to a - * specific state. - * - * Note: this field should only be used if you are connecting to a Dialogflow - * CX agent. - * @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 include:samples/generated/v2beta1/participants.analyze_content.js - * region_tag:dialogflow_v2beta1_generated_Participants_AnalyzeContent_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'participant': request.participant ?? '', - }); - this.initialize(); - return this.innerApiCalls.analyzeContent(request, options, callback); - } -/** - * 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 {google.cloud.dialogflow.v2beta1.AssistQueryParameters} [request.assistQueryParams] - * Optional. Parameters for a human assist query. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2beta1/participants.suggest_articles.js - * region_tag:dialogflow_v2beta1_generated_Participants_SuggestArticles_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.suggestArticles(request, options, callback); - } -/** - * 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 {google.cloud.dialogflow.v2beta1.AssistQueryParameters} [request.assistQueryParams] - * Optional. Parameters for a human assist query. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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 include:samples/generated/v2beta1/participants.suggest_faq_answers.js - * region_tag:dialogflow_v2beta1_generated_Participants_SuggestFaqAnswers_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.suggestFaqAnswers(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/participants.suggest_smart_replies.js - * region_tag:dialogflow_v2beta1_generated_Participants_SuggestSmartReplies_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.suggestSmartReplies(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/participants.compile_suggestion.js - * region_tag:dialogflow_v2beta1_generated_Participants_CompileSuggestion_async - * @deprecated CompileSuggestion is deprecated and may be removed in a future version. - */ - 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; - 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' - ] = this._gaxModule.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); - } - -/** - * Adds a text (e.g., chat) or audio (e.g., phone recording) message from a - * participant into the conversation. - * Note: This method is only available through the gRPC API (not REST). - * - * The top-level message sent to the client by the server is - * `StreamingAnalyzeContentResponse`. Multiple response messages can be - * returned in order. The first one or more messages contain the - * `recognition_result` field. Each result represents a more complete - * transcript of what the user said. The next message contains the - * `reply_text` field, and potentially the `reply_audio` and/or the - * `automated_agent_reply` fields. - * - * 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} [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 [StreamingAnalyzeContentRequest]{@link google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest} for write() method, and - * will emit objects representing [StreamingAnalyzeContentResponse]{@link google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse} 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 include:samples/generated/v2beta1/participants.streaming_analyze_content.js - * region_tag:dialogflow_v2beta1_generated_Participants_StreamingAnalyzeContent_async - */ - streamingAnalyzeContent( - options?: CallOptions): - gax.CancellableStream { - this.initialize(); - return this.innerApiCalls.streamingAnalyzeContent(null, options); - } - - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listParticipants']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listParticipants.createStream( - this.innerApiCalls.listParticipants as 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 include:samples/generated/v2beta1/participants.list_participants.js - * region_tag:dialogflow_v2beta1_generated_Participants_ListParticipants_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listParticipants']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listParticipants.asyncIterate( - this.innerApiCalls['listParticipants'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSuggestions']; - const callSettings = defaultCallSettings.merge(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 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 include:samples/generated/v2beta1/participants.list_suggestions.js - * region_tag:dialogflow_v2beta1_generated_Participants_ListSuggestions_async - * @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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSuggestions']; - const callSettings = defaultCallSettings.merge(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 {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- 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 { - if (this.participantsStub && !this._terminated) { - return this.participantsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/participants_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/participants_client_config.json deleted file mode 100644 index 2b59076003d..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/participants_client_config.json +++ /dev/null @@ -1,84 +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" - }, - "StreamingAnalyzeContent": { - "timeout_millis": 220000, - "retry_codes_name": "non_idempotent", - "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/google-cloud-dialogflow/v2beta1/src/v2beta1/participants_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/participants_proto_list.json deleted file mode 100644 index cb5136f11dc..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/session_entity_types_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/session_entity_types_client.ts deleted file mode 100644 index 6089ab48f51..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/session_entity_types_client.ts +++ /dev/null @@ -1,2823 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SessionEntityTypesClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = this._gaxModule.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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2beta1/session_entity_types.get_session_entity_type.js - * region_tag:dialogflow_v2beta1_generated_SessionEntityTypes_GetSessionEntityType_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getSessionEntityType(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/session_entity_types.create_session_entity_type.js - * region_tag:dialogflow_v2beta1_generated_SessionEntityTypes_CreateSessionEntityType_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createSessionEntityType(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/session_entity_types.update_session_entity_type.js - * region_tag:dialogflow_v2beta1_generated_SessionEntityTypes_UpdateSessionEntityType_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'session_entity_type.name': request.sessionEntityType!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateSessionEntityType(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/session_entity_types.delete_session_entity_type.js - * region_tag:dialogflow_v2beta1_generated_SessionEntityTypes_DeleteSessionEntityType_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteSessionEntityType(request, options, callback); - } - - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSessionEntityTypes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSessionEntityTypes.createStream( - this.innerApiCalls.listSessionEntityTypes as 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 include:samples/generated/v2beta1/session_entity_types.list_session_entity_types.js - * region_tag:dialogflow_v2beta1_generated_SessionEntityTypes_ListSessionEntityTypes_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSessionEntityTypes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSessionEntityTypes.asyncIterate( - this.innerApiCalls['listSessionEntityTypes'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- 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 { - if (this.sessionEntityTypesStub && !this._terminated) { - return this.sessionEntityTypesStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/session_entity_types_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/session_entity_types_client_config.json deleted file mode 100644 index f007c235e62..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/session_entity_types_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/session_entity_types_proto_list.json deleted file mode 100644 index cb5136f11dc..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/sessions_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/sessions_client.ts deleted file mode 100644 index 712824633ae..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/sessions_client.ts +++ /dev/null @@ -1,2602 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} from 'google-gax'; -import {PassThrough} from 'stream'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SessionsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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(this._gaxModule.StreamType.BIDI_STREAMING, opts.fallback === 'rest') - }; - - // 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 = this._gaxModule.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) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough(); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; - } - 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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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. - * - * If you might use - * [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) - * or other CCAI products now or in the future, consider using - * {@link google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent|AnalyzeContent} - * instead of `DetectIntent`. `AnalyzeContent` has additional - * functionality for Agent Assist and other CCAI products. - * - * 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 include:samples/generated/v2beta1/sessions.detect_intent.js - * region_tag:dialogflow_v2beta1_generated_Sessions_DetectIntent_async - */ - 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; - 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' - ] = this._gaxModule.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). - * - * If you might use - * [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) - * or other CCAI products now or in the future, consider using - * {@link google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent|StreamingAnalyzeContent} - * instead of `StreamingDetectIntent`. `StreamingAnalyzeContent` has - * additional functionality for Agent Assist and other CCAI products. - * - * 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 include:samples/generated/v2beta1/sessions.streaming_detect_intent.js - * region_tag:dialogflow_v2beta1_generated_Sessions_StreamingDetectIntent_async - */ - streamingDetectIntent( - options?: CallOptions): - gax.CancellableStream { - this.initialize(); - return this.innerApiCalls.streamingDetectIntent(null, options); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, 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 { - if (this.sessionsStub && !this._terminated) { - return this.sessionsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/sessions_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/sessions_client_config.json deleted file mode 100644 index e36850ea9dc..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/sessions_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/sessions_proto_list.json deleted file mode 100644 index cb5136f11dc..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/versions_client.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/versions_client.ts deleted file mode 100644 index 80ca7b9f7c0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/versions_client.ts +++ /dev/null @@ -1,2712 +0,0 @@ -// Copyright 2022 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 type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -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}; - locationsClient: LocationsClient; - 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/main/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new VersionsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // 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; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // 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 useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // 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 = this._gaxModule.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._opts.fallback - ); - - 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 -- - // ------------------- -/** - * 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 include:samples/generated/v2beta1/versions.get_version.js - * region_tag:dialogflow_v2beta1_generated_Versions_GetVersion_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getVersion(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/versions.create_version.js - * region_tag:dialogflow_v2beta1_generated_Versions_CreateVersion_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createVersion(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/versions.update_version.js - * region_tag:dialogflow_v2beta1_generated_Versions_UpdateVersion_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'version.name': request.version!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateVersion(request, options, callback); - } -/** - * 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 include:samples/generated/v2beta1/versions.delete_version.js - * region_tag:dialogflow_v2beta1_generated_Versions_DeleteVersion_async - */ - 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; - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteVersion(request, options, callback); - } - - /** - * 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, - 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; - 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' - ] = this._gaxModule.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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listVersions.createStream( - this.innerApiCalls.listVersions as 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 include:samples/generated/v2beta1/versions.list_versions.js - * region_tag:dialogflow_v2beta1_generated_Versions_ListVersions_async - */ - 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' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listVersions.asyncIterate( - this.innerApiCalls['listVersions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * 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.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 - * [Location]{@link google.cloud.location.Location}. 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.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- 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 { - if (this.versionsStub && !this._terminated) { - return this.versionsStub.then(stub => { - this._terminated = true; - stub.close(); - this.locationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/versions_client_config.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/versions_client_config.json deleted file mode 100644 index e748590d57d..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/src/v2beta1/versions_proto_list.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/src/v2beta1/versions_proto_list.json deleted file mode 100644 index cb5136f11dc..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 2bd79823b3a..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2022 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/google-cloud-dialogflow/v2beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index ca5b44bbee6..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright 2022 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/google-cloud-dialogflow/v2beta1/system-test/install.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/system-test/install.ts deleted file mode 100644 index 557a57558e1..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 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/google-cloud-dialogflow/v2beta1/test/gapic_agents_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_agents_v2beta1.ts deleted file mode 100644 index f65fc9b2b3b..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_agents_v2beta1.ts +++ /dev/null @@ -1,3536 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.agentsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.agentsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAgent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAgent(request), expectedError); - const actualRequest = (client.innerApiCalls.getAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAgent with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getAgent(request), expectedError); - }); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SetAgentRequest', ['agent', 'parent']); - request.agent.parent = defaultValue1; - const expectedHeaderRequestParams = `agent.parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.setAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SetAgentRequest', ['agent', 'parent']); - request.agent.parent = defaultValue1; - const expectedHeaderRequestParams = `agent.parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.setAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SetAgentRequest', ['agent', 'parent']); - request.agent.parent = defaultValue1; - const expectedHeaderRequestParams = `agent.parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setAgent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setAgent(request), expectedError); - const actualRequest = (client.innerApiCalls.setAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setAgent with closed client', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SetAgentRequest', ['agent', 'parent']); - request.agent.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setAgent(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteAgent = stubSimpleCall(expectedResponse); - const [response] = await client.deleteAgent(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.deleteAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAgent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteAgent(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAgent with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteAgent(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetValidationResultRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getValidationResult as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getValidationResult as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetValidationResultRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getValidationResult as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getValidationResult as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetValidationResultRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getValidationResult = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getValidationResult(request), expectedError); - const actualRequest = (client.innerApiCalls.getValidationResult as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getValidationResult as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getValidationResult with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetValidationResultRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getValidationResult(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.TrainAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.trainAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.trainAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.TrainAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.trainAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.trainAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.TrainAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.trainAgent = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.trainAgent(request), expectedError); - const actualRequest = (client.innerApiCalls.trainAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.trainAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.TrainAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.trainAgent = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.trainAgent(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.trainAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.trainAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ExportAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.exportAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ExportAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.exportAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ExportAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportAgent = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.exportAgent(request), expectedError); - const actualRequest = (client.innerApiCalls.exportAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ExportAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportAgent = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.exportAgent(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.exportAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ImportAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.importAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ImportAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.importAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ImportAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importAgent = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.importAgent(request), expectedError); - const actualRequest = (client.innerApiCalls.importAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ImportAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importAgent = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.importAgent(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.importAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.RestoreAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.restoreAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.RestoreAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.restoreAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.RestoreAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreAgent = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.restoreAgent(request), expectedError); - const actualRequest = (client.innerApiCalls.restoreAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.RestoreAgentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreAgent = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.restoreAgent(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.restoreAgent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreAgent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SearchAgentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.searchAgents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAgents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SearchAgentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.searchAgents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAgents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SearchAgentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.searchAgents = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.searchAgents(request), expectedError); - const actualRequest = (client.innerApiCalls.searchAgents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAgents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SearchAgentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.searchAgents.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SearchAgentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.searchAgents.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SearchAgentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.searchAgents.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SearchAgentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.searchAgents.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new agentsModule.v2beta1.AgentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - 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/google-cloud-dialogflow/v2beta1/test/gapic_answer_records_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_answer_records_v2beta1.ts deleted file mode 100644 index 484004c7e24..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_answer_records_v2beta1.ts +++ /dev/null @@ -1,2441 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.answerRecordsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.answerRecordsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getAnswerRecord as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAnswerRecord as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getAnswerRecord as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAnswerRecord as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAnswerRecord = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAnswerRecord(request), expectedError); - assert(stub.calledOnce); - const actualRequest = (client.innerApiCalls.getAnswerRecord as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAnswerRecord as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAnswerRecord with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getAnswerRecord(request), expectedError); - assert(stub.calledOnce); - }); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest', ['answerRecord', 'name']); - request.answerRecord.name = defaultValue1; - const expectedHeaderRequestParams = `answer_record.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateAnswerRecord as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAnswerRecord as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest', ['answerRecord', 'name']); - request.answerRecord.name = defaultValue1; - const expectedHeaderRequestParams = `answer_record.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateAnswerRecord as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAnswerRecord as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest', ['answerRecord', 'name']); - request.answerRecord.name = defaultValue1; - const expectedHeaderRequestParams = `answer_record.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAnswerRecord = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateAnswerRecord(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAnswerRecord as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAnswerRecord as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAnswerRecord with closed client', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest', ['answerRecord', 'name']); - request.answerRecord.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateAnswerRecord(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listAnswerRecords as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAnswerRecords as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listAnswerRecords as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAnswerRecords as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAnswerRecords = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAnswerRecords(request), expectedError); - const actualRequest = (client.innerApiCalls.listAnswerRecords as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAnswerRecords as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listAnswerRecords.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listAnswerRecords.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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/google-cloud-dialogflow/v2beta1/test/gapic_contexts_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_contexts_v2beta1.ts deleted file mode 100644 index 3254ca0ee2d..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_contexts_v2beta1.ts +++ /dev/null @@ -1,2795 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.contextsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.contextsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetContextRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getContext as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getContext as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetContextRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getContext as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getContext as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetContextRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getContext = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getContext(request), expectedError); - const actualRequest = (client.innerApiCalls.getContext as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getContext as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getContext with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetContextRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getContext(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateContextRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createContext as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createContext as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateContextRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createContext as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createContext as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateContextRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createContext = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createContext(request), expectedError); - const actualRequest = (client.innerApiCalls.createContext as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createContext as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createContext with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateContextRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createContext(request), expectedError); - }); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateContextRequest', ['context', 'name']); - request.context.name = defaultValue1; - const expectedHeaderRequestParams = `context.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateContext as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateContext as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateContextRequest', ['context', 'name']); - request.context.name = defaultValue1; - const expectedHeaderRequestParams = `context.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateContext as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateContext as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateContextRequest', ['context', 'name']); - request.context.name = defaultValue1; - const expectedHeaderRequestParams = `context.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateContext = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateContext(request), expectedError); - const actualRequest = (client.innerApiCalls.updateContext as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateContext as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateContext with closed client', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateContextRequest', ['context', 'name']); - request.context.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateContext(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteContextRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteContext = stubSimpleCall(expectedResponse); - const [response] = await client.deleteContext(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteContext as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteContext as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteContextRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.deleteContext as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteContext as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteContextRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteContext = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteContext(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteContext as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteContext as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteContext with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteContextRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteContext(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteAllContexts = stubSimpleCall(expectedResponse); - const [response] = await client.deleteAllContexts(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAllContexts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAllContexts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.deleteAllContexts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAllContexts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAllContexts = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteAllContexts(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAllContexts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAllContexts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAllContexts with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteAllContexts(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListContextsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listContexts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listContexts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListContextsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listContexts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listContexts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListContextsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listContexts = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listContexts(request), expectedError); - const actualRequest = (client.innerApiCalls.listContexts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listContexts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListContextsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listContexts.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListContextsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listContexts.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListContextsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listContexts.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListContextsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listContexts.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new contextsModule.v2beta1.ContextsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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/google-cloud-dialogflow/v2beta1/test/gapic_conversation_profiles_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_conversation_profiles_v2beta1.ts deleted file mode 100644 index ab51fddbba6..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_conversation_profiles_v2beta1.ts +++ /dev/null @@ -1,3274 +0,0 @@ -// Copyright 2022 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, LROperation, operationsProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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.ConversationProfilesClient', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.conversationProfilesStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.conversationProfilesStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getConversationProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConversationProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getConversationProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConversationProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getConversationProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getConversationProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.getConversationProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConversationProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConversationProfile with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getConversationProfile(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createConversationProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConversationProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createConversationProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConversationProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConversationProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createConversationProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.createConversationProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConversationProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConversationProfile with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createConversationProfile(request), expectedError); - }); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest', ['conversationProfile', 'name']); - request.conversationProfile.name = defaultValue1; - const expectedHeaderRequestParams = `conversation_profile.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateConversationProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConversationProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest', ['conversationProfile', 'name']); - request.conversationProfile.name = defaultValue1; - const expectedHeaderRequestParams = `conversation_profile.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateConversationProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConversationProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest', ['conversationProfile', 'name']); - request.conversationProfile.name = defaultValue1; - const expectedHeaderRequestParams = `conversation_profile.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateConversationProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateConversationProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.updateConversationProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConversationProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateConversationProfile with closed client', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest', ['conversationProfile', 'name']); - request.conversationProfile.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateConversationProfile(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteConversationProfile = stubSimpleCall(expectedResponse); - const [response] = await client.deleteConversationProfile(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteConversationProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.deleteConversationProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConversationProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteConversationProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteConversationProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConversationProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConversationProfile with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteConversationProfile(request), expectedError); - }); - }); - - describe('setSuggestionFeatureConfig', () => { - it('invokes setSuggestionFeatureConfig 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.SetSuggestionFeatureConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest', ['conversationProfile']); - request.conversationProfile = defaultValue1; - const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.setSuggestionFeatureConfig = stubLongRunningCall(expectedResponse); - const [operation] = await client.setSuggestionFeatureConfig(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setSuggestionFeatureConfig 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.SetSuggestionFeatureConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest', ['conversationProfile']); - request.conversationProfile = defaultValue1; - const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.setSuggestionFeatureConfig = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setSuggestionFeatureConfig( - 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); - const actualRequest = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setSuggestionFeatureConfig with call 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.SetSuggestionFeatureConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest', ['conversationProfile']); - request.conversationProfile = defaultValue1; - const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setSuggestionFeatureConfig = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.setSuggestionFeatureConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setSuggestionFeatureConfig with LRO 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.SetSuggestionFeatureConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest', ['conversationProfile']); - request.conversationProfile = defaultValue1; - const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.setSuggestionFeatureConfig = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.setSuggestionFeatureConfig(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setSuggestionFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkSetSuggestionFeatureConfigProgress without error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - 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.checkSetSuggestionFeatureConfigProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkSetSuggestionFeatureConfigProgress with error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - 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.checkSetSuggestionFeatureConfigProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('clearSuggestionFeatureConfig', () => { - it('invokes clearSuggestionFeatureConfig 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.ClearSuggestionFeatureConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest', ['conversationProfile']); - request.conversationProfile = defaultValue1; - const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.clearSuggestionFeatureConfig = stubLongRunningCall(expectedResponse); - const [operation] = await client.clearSuggestionFeatureConfig(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes clearSuggestionFeatureConfig 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.ClearSuggestionFeatureConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest', ['conversationProfile']); - request.conversationProfile = defaultValue1; - const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.clearSuggestionFeatureConfig = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.clearSuggestionFeatureConfig( - 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); - const actualRequest = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes clearSuggestionFeatureConfig with call 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.ClearSuggestionFeatureConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest', ['conversationProfile']); - request.conversationProfile = defaultValue1; - const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.clearSuggestionFeatureConfig = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.clearSuggestionFeatureConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes clearSuggestionFeatureConfig with LRO 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.ClearSuggestionFeatureConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest', ['conversationProfile']); - request.conversationProfile = defaultValue1; - const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.clearSuggestionFeatureConfig = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.clearSuggestionFeatureConfig(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkClearSuggestionFeatureConfigProgress without error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - 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.checkClearSuggestionFeatureConfigProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkClearSuggestionFeatureConfigProgress with error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - 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.checkClearSuggestionFeatureConfigProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listConversationProfiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConversationProfiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listConversationProfiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConversationProfiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listConversationProfiles = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listConversationProfiles(request), expectedError); - const actualRequest = (client.innerApiCalls.listConversationProfiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConversationProfiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listConversationProfiles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listConversationProfiles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listConversationProfiles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listConversationProfiles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('cXSecuritySettings', () => { - const fakePath = "/rendered/path/cXSecuritySettings"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - security_settings: "securitySettingsValue", - }; - const client = new conversationprofilesModule.v2beta1.ConversationProfilesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.cXSecuritySettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.cXSecuritySettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('cXSecuritySettingsPath', () => { - const result = client.cXSecuritySettingsPath("projectValue", "locationValue", "securitySettingsValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.cXSecuritySettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCXSecuritySettingsName', () => { - const result = client.matchProjectFromCXSecuritySettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.cXSecuritySettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCXSecuritySettingsName', () => { - const result = client.matchLocationFromCXSecuritySettingsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.cXSecuritySettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecuritySettingsFromCXSecuritySettingsName', () => { - const result = client.matchSecuritySettingsFromCXSecuritySettingsName(fakePath); - assert.strictEqual(result, "securitySettingsValue"); - assert((client.pathTemplates.cXSecuritySettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - 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/google-cloud-dialogflow/v2beta1/test/gapic_conversations_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_conversations_v2beta1.ts deleted file mode 100644 index 67ff4c3aa6b..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_conversations_v2beta1.ts +++ /dev/null @@ -1,2998 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.conversationsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.conversationsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateConversationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createConversation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConversation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateConversationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createConversation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConversation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateConversationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConversation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createConversation(request), expectedError); - const actualRequest = (client.innerApiCalls.createConversation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConversation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConversation with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateConversationRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createConversation(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetConversationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getConversation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConversation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetConversationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getConversation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConversation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetConversationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getConversation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getConversation(request), expectedError); - const actualRequest = (client.innerApiCalls.getConversation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConversation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConversation with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetConversationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getConversation(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CompleteConversationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.completeConversation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.completeConversation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CompleteConversationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.completeConversation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.completeConversation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CompleteConversationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.completeConversation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.completeConversation(request), expectedError); - const actualRequest = (client.innerApiCalls.completeConversation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.completeConversation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes completeConversation with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CompleteConversationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.completeConversation(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchCreateMessages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateMessages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchCreateMessages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateMessages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchCreateMessages = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.batchCreateMessages(request), expectedError); - const actualRequest = (client.innerApiCalls.batchCreateMessages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateMessages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateMessages with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.batchCreateMessages(request), expectedError); - }); - }); - - describe('suggestConversationSummary', () => { - it('invokes suggestConversationSummary 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.SuggestConversationSummaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest', ['conversation']); - request.conversation = defaultValue1; - const expectedHeaderRequestParams = `conversation=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse() - ); - client.innerApiCalls.suggestConversationSummary = stubSimpleCall(expectedResponse); - const [response] = await client.suggestConversationSummary(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.suggestConversationSummary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.suggestConversationSummary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes suggestConversationSummary 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.SuggestConversationSummaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest', ['conversation']); - request.conversation = defaultValue1; - const expectedHeaderRequestParams = `conversation=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse() - ); - client.innerApiCalls.suggestConversationSummary = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.suggestConversationSummary( - request, - (err?: Error|null, result?: protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.suggestConversationSummary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.suggestConversationSummary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes suggestConversationSummary 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.SuggestConversationSummaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest', ['conversation']); - request.conversation = defaultValue1; - const expectedHeaderRequestParams = `conversation=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.suggestConversationSummary = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.suggestConversationSummary(request), expectedError); - const actualRequest = (client.innerApiCalls.suggestConversationSummary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.suggestConversationSummary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes suggestConversationSummary with closed client', 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.SuggestConversationSummaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest', ['conversation']); - request.conversation = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.suggestConversationSummary(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listConversations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConversations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listConversations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConversations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listConversations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listConversations(request), expectedError); - const actualRequest = (client.innerApiCalls.listConversations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConversations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listConversations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listConversations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listConversations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListConversationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listConversations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListMessagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listMessages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMessages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListMessagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listMessages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMessages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListMessagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMessages = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMessages(request), expectedError); - const actualRequest = (client.innerApiCalls.listMessages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMessages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListMessagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listMessages.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListMessagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listMessages.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListMessagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listMessages.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListMessagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listMessages.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new conversationsModule.v2beta1.ConversationsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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/google-cloud-dialogflow/v2beta1/test/gapic_documents_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_documents_v2beta1.ts deleted file mode 100644 index b957891f84a..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_documents_v2beta1.ts +++ /dev/null @@ -1,3366 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.documentsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.documentsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDocument = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDocument(request), expectedError); - const actualRequest = (client.innerApiCalls.getDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDocument with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getDocument(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateDocumentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateDocumentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateDocumentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDocument = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createDocument(request), expectedError); - const actualRequest = (client.innerApiCalls.createDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateDocumentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDocument = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createDocument(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.importDocuments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importDocuments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.importDocuments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importDocuments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importDocuments = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.importDocuments(request), expectedError); - const actualRequest = (client.innerApiCalls.importDocuments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importDocuments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.importDocuments = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.importDocuments(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.importDocuments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importDocuments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.deleteDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.deleteDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDocument = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteDocument(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDocument = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteDocument(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest', ['document', 'name']); - request.document.name = defaultValue1; - const expectedHeaderRequestParams = `document.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest', ['document', 'name']); - request.document.name = defaultValue1; - const expectedHeaderRequestParams = `document.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest', ['document', 'name']); - request.document.name = defaultValue1; - const expectedHeaderRequestParams = `document.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDocument = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateDocument(request), expectedError); - const actualRequest = (client.innerApiCalls.updateDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest', ['document', 'name']); - request.document.name = defaultValue1; - const expectedHeaderRequestParams = `document.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDocument = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateDocument(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.reloadDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reloadDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.reloadDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reloadDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.reloadDocument = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.reloadDocument(request), expectedError); - const actualRequest = (client.innerApiCalls.reloadDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reloadDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.reloadDocument = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.reloadDocument(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.reloadDocument as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reloadDocument as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListDocumentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listDocuments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDocuments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListDocumentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listDocuments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDocuments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListDocumentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDocuments = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDocuments(request), expectedError); - const actualRequest = (client.innerApiCalls.listDocuments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDocuments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListDocumentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listDocuments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListDocumentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listDocuments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListDocumentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listDocuments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListDocumentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listDocuments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new documentsModule.v2beta1.DocumentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - 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/google-cloud-dialogflow/v2beta1/test/gapic_entity_types_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_entity_types_v2beta1.ts deleted file mode 100644 index 9bfd1cd18d0..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_entity_types_v2beta1.ts +++ /dev/null @@ -1,3690 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.entityTypesStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.entityTypesStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getEntityType(request), expectedError); - const actualRequest = (client.innerApiCalls.getEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getEntityType with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getEntityType(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createEntityType(request), expectedError); - const actualRequest = (client.innerApiCalls.createEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createEntityType with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createEntityType(request), expectedError); - }); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest', ['entityType', 'name']); - request.entityType.name = defaultValue1; - const expectedHeaderRequestParams = `entity_type.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest', ['entityType', 'name']); - request.entityType.name = defaultValue1; - const expectedHeaderRequestParams = `entity_type.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest', ['entityType', 'name']); - request.entityType.name = defaultValue1; - const expectedHeaderRequestParams = `entity_type.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateEntityType(request), expectedError); - const actualRequest = (client.innerApiCalls.updateEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateEntityType with closed client', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest', ['entityType', 'name']); - request.entityType.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateEntityType(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteEntityType = stubSimpleCall(expectedResponse); - const [response] = await client.deleteEntityType(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.deleteEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteEntityType(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteEntityType with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteEntityType(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchUpdateEntityTypes(request), expectedError); - const actualRequest = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchUpdateEntityTypes(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchDeleteEntityTypes(request), expectedError); - const actualRequest = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchDeleteEntityTypes(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchCreateEntities as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateEntities as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchCreateEntities as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateEntities as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchCreateEntities = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchCreateEntities(request), expectedError); - const actualRequest = (client.innerApiCalls.batchCreateEntities as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateEntities as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchCreateEntities = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchCreateEntities(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.batchCreateEntities as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateEntities as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchUpdateEntities as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntities as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchUpdateEntities as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntities as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateEntities = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchUpdateEntities(request), expectedError); - const actualRequest = (client.innerApiCalls.batchUpdateEntities as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntities as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateEntities = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchUpdateEntities(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.batchUpdateEntities as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateEntities as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchDeleteEntities as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntities as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchDeleteEntities as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntities as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteEntities = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchDeleteEntities(request), expectedError); - const actualRequest = (client.innerApiCalls.batchDeleteEntities as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntities as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteEntities = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchDeleteEntities(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.batchDeleteEntities as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteEntities as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listEntityTypes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listEntityTypes(request), expectedError); - const actualRequest = (client.innerApiCalls.listEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listEntityTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listEntityTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new entitytypesModule.v2beta1.EntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - 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/google-cloud-dialogflow/v2beta1/test/gapic_environments_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_environments_v2beta1.ts deleted file mode 100644 index 825a4b50994..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_environments_v2beta1.ts +++ /dev/null @@ -1,2894 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.environmentsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.environmentsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getEnvironment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEnvironment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getEnvironment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEnvironment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getEnvironment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getEnvironment(request), expectedError); - const actualRequest = (client.innerApiCalls.getEnvironment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEnvironment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getEnvironment with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getEnvironment(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createEnvironment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEnvironment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createEnvironment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEnvironment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createEnvironment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createEnvironment(request), expectedError); - const actualRequest = (client.innerApiCalls.createEnvironment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEnvironment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createEnvironment with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createEnvironment(request), expectedError); - }); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest', ['environment', 'name']); - request.environment.name = defaultValue1; - const expectedHeaderRequestParams = `environment.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateEnvironment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEnvironment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest', ['environment', 'name']); - request.environment.name = defaultValue1; - const expectedHeaderRequestParams = `environment.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateEnvironment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEnvironment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest', ['environment', 'name']); - request.environment.name = defaultValue1; - const expectedHeaderRequestParams = `environment.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateEnvironment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateEnvironment(request), expectedError); - const actualRequest = (client.innerApiCalls.updateEnvironment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEnvironment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateEnvironment with closed client', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest', ['environment', 'name']); - request.environment.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateEnvironment(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteEnvironment = stubSimpleCall(expectedResponse); - const [response] = await client.deleteEnvironment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteEnvironment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteEnvironment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.deleteEnvironment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteEnvironment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteEnvironment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteEnvironment(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteEnvironment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteEnvironment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteEnvironment with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteEnvironment(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listEnvironments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEnvironments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listEnvironments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEnvironments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listEnvironments = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listEnvironments(request), expectedError); - const actualRequest = (client.innerApiCalls.listEnvironments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEnvironments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listEnvironments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listEnvironments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.getEnvironmentHistory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEnvironmentHistory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.getEnvironmentHistory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEnvironmentHistory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getEnvironmentHistory = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getEnvironmentHistory(request), expectedError); - const actualRequest = (client.innerApiCalls.getEnvironmentHistory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEnvironmentHistory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.getEnvironmentHistory.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.getEnvironmentHistory.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.getEnvironmentHistory.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.getEnvironmentHistory.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new environmentsModule.v2beta1.EnvironmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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/google-cloud-dialogflow/v2beta1/test/gapic_fulfillments_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_fulfillments_v2beta1.ts deleted file mode 100644 index 9440aace75c..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_fulfillments_v2beta1.ts +++ /dev/null @@ -1,2131 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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 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.FulfillmentsClient', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.fulfillmentsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.fulfillmentsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getFulfillment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFulfillment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getFulfillment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFulfillment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFulfillment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFulfillment(request), expectedError); - const actualRequest = (client.innerApiCalls.getFulfillment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFulfillment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFulfillment with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFulfillment(request), expectedError); - }); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest', ['fulfillment', 'name']); - request.fulfillment.name = defaultValue1; - const expectedHeaderRequestParams = `fulfillment.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateFulfillment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFulfillment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest', ['fulfillment', 'name']); - request.fulfillment.name = defaultValue1; - const expectedHeaderRequestParams = `fulfillment.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateFulfillment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFulfillment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest', ['fulfillment', 'name']); - request.fulfillment.name = defaultValue1; - const expectedHeaderRequestParams = `fulfillment.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFulfillment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateFulfillment(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFulfillment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFulfillment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFulfillment with closed client', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest', ['fulfillment', 'name']); - request.fulfillment.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateFulfillment(request), expectedError); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - 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/google-cloud-dialogflow/v2beta1/test/gapic_intents_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_intents_v2beta1.ts deleted file mode 100644 index 091b947b4f9..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_intents_v2beta1.ts +++ /dev/null @@ -1,3228 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.intentsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.intentsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetIntentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetIntentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetIntentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getIntent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIntent(request), expectedError); - const actualRequest = (client.innerApiCalls.getIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIntent with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetIntentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getIntent(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateIntentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateIntentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateIntentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createIntent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createIntent(request), expectedError); - const actualRequest = (client.innerApiCalls.createIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createIntent with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateIntentRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createIntent(request), expectedError); - }); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateIntentRequest', ['intent', 'name']); - request.intent.name = defaultValue1; - const expectedHeaderRequestParams = `intent.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateIntentRequest', ['intent', 'name']); - request.intent.name = defaultValue1; - const expectedHeaderRequestParams = `intent.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateIntentRequest', ['intent', 'name']); - request.intent.name = defaultValue1; - const expectedHeaderRequestParams = `intent.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateIntent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateIntent(request), expectedError); - const actualRequest = (client.innerApiCalls.updateIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateIntent with closed client', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateIntentRequest', ['intent', 'name']); - request.intent.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateIntent(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteIntentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteIntent = stubSimpleCall(expectedResponse); - const [response] = await client.deleteIntent(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteIntentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.deleteIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteIntentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteIntent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteIntent(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteIntent with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteIntentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteIntent(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchUpdateIntents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateIntents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchUpdateIntents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateIntents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateIntents = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchUpdateIntents(request), expectedError); - const actualRequest = (client.innerApiCalls.batchUpdateIntents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateIntents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateIntents = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchUpdateIntents(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.batchUpdateIntents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateIntents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchDeleteIntents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteIntents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.batchDeleteIntents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteIntents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteIntents = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchDeleteIntents(request), expectedError); - const actualRequest = (client.innerApiCalls.batchDeleteIntents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteIntents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteIntents = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchDeleteIntents(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.batchDeleteIntents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteIntents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listIntents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listIntents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listIntents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listIntents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listIntents = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listIntents(request), expectedError); - const actualRequest = (client.innerApiCalls.listIntents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listIntents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listIntents.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listIntents.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listIntents.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListIntentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listIntents.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new intentsModule.v2beta1.IntentsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - 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/google-cloud-dialogflow/v2beta1/test/gapic_knowledge_bases_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_knowledge_bases_v2beta1.ts deleted file mode 100644 index a6a55d91bb8..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_knowledge_bases_v2beta1.ts +++ /dev/null @@ -1,2649 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.knowledgeBasesStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.knowledgeBasesStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getKnowledgeBase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getKnowledgeBase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getKnowledgeBase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getKnowledgeBase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getKnowledgeBase = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getKnowledgeBase(request), expectedError); - const actualRequest = (client.innerApiCalls.getKnowledgeBase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getKnowledgeBase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getKnowledgeBase with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getKnowledgeBase(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createKnowledgeBase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createKnowledgeBase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createKnowledgeBase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createKnowledgeBase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createKnowledgeBase = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createKnowledgeBase(request), expectedError); - const actualRequest = (client.innerApiCalls.createKnowledgeBase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createKnowledgeBase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createKnowledgeBase with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createKnowledgeBase(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteKnowledgeBase = stubSimpleCall(expectedResponse); - const [response] = await client.deleteKnowledgeBase(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteKnowledgeBase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteKnowledgeBase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.deleteKnowledgeBase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteKnowledgeBase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteKnowledgeBase = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteKnowledgeBase(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteKnowledgeBase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteKnowledgeBase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteKnowledgeBase with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteKnowledgeBase(request), expectedError); - }); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest', ['knowledgeBase', 'name']); - request.knowledgeBase.name = defaultValue1; - const expectedHeaderRequestParams = `knowledge_base.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateKnowledgeBase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateKnowledgeBase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest', ['knowledgeBase', 'name']); - request.knowledgeBase.name = defaultValue1; - const expectedHeaderRequestParams = `knowledge_base.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateKnowledgeBase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateKnowledgeBase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest', ['knowledgeBase', 'name']); - request.knowledgeBase.name = defaultValue1; - const expectedHeaderRequestParams = `knowledge_base.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateKnowledgeBase = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateKnowledgeBase(request), expectedError); - const actualRequest = (client.innerApiCalls.updateKnowledgeBase as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateKnowledgeBase as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateKnowledgeBase with closed client', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest', ['knowledgeBase', 'name']); - request.knowledgeBase.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateKnowledgeBase(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listKnowledgeBases as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listKnowledgeBases as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listKnowledgeBases as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listKnowledgeBases as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listKnowledgeBases = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listKnowledgeBases(request), expectedError); - const actualRequest = (client.innerApiCalls.listKnowledgeBases as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listKnowledgeBases as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listKnowledgeBases.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listKnowledgeBases.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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/google-cloud-dialogflow/v2beta1/test/gapic_participants_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_participants_v2beta1.ts deleted file mode 100644 index 3c5a66042db..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_participants_v2beta1.ts +++ /dev/null @@ -1,3421 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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); -} - -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', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.participantsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.participantsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateParticipantRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createParticipant as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createParticipant as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateParticipantRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createParticipant as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createParticipant as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateParticipantRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createParticipant = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createParticipant(request), expectedError); - const actualRequest = (client.innerApiCalls.createParticipant as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createParticipant as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createParticipant with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateParticipantRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createParticipant(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetParticipantRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getParticipant as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getParticipant as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetParticipantRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getParticipant as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getParticipant as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetParticipantRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getParticipant = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getParticipant(request), expectedError); - const actualRequest = (client.innerApiCalls.getParticipant as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getParticipant as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getParticipant with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetParticipantRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getParticipant(request), expectedError); - }); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest', ['participant', 'name']); - request.participant.name = defaultValue1; - const expectedHeaderRequestParams = `participant.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateParticipant as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateParticipant as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest', ['participant', 'name']); - request.participant.name = defaultValue1; - const expectedHeaderRequestParams = `participant.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateParticipant as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateParticipant as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest', ['participant', 'name']); - request.participant.name = defaultValue1; - const expectedHeaderRequestParams = `participant.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateParticipant = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateParticipant(request), expectedError); - const actualRequest = (client.innerApiCalls.updateParticipant as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateParticipant as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateParticipant with closed client', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest', ['participant', 'name']); - request.participant.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateParticipant(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest', ['participant']); - request.participant = defaultValue1; - const expectedHeaderRequestParams = `participant=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.analyzeContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.analyzeContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest', ['participant']); - request.participant = defaultValue1; - const expectedHeaderRequestParams = `participant=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.analyzeContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.analyzeContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest', ['participant']); - request.participant = defaultValue1; - const expectedHeaderRequestParams = `participant=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.analyzeContent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.analyzeContent(request), expectedError); - const actualRequest = (client.innerApiCalls.analyzeContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.analyzeContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes analyzeContent with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest', ['participant']); - request.participant = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.analyzeContent(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.suggestArticles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.suggestArticles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.suggestArticles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.suggestArticles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.suggestArticles = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.suggestArticles(request), expectedError); - const actualRequest = (client.innerApiCalls.suggestArticles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.suggestArticles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes suggestArticles with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.suggestArticles(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.suggestFaqAnswers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.suggestFaqAnswers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.suggestFaqAnswers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.suggestFaqAnswers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.suggestFaqAnswers = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.suggestFaqAnswers(request), expectedError); - const actualRequest = (client.innerApiCalls.suggestFaqAnswers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.suggestFaqAnswers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes suggestFaqAnswers with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.suggestFaqAnswers(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.suggestSmartReplies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.suggestSmartReplies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.suggestSmartReplies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.suggestSmartReplies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.suggestSmartReplies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.suggestSmartReplies(request), expectedError); - const actualRequest = (client.innerApiCalls.suggestSmartReplies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.suggestSmartReplies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes suggestSmartReplies with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.suggestSmartReplies(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.compileSuggestion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.compileSuggestion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.compileSuggestion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.compileSuggestion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.compileSuggestion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.compileSuggestion(request), expectedError); - assert(stub.calledOnce); - const actualRequest = (client.innerApiCalls.compileSuggestion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.compileSuggestion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes compileSuggestion with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.compileSuggestion(request), expectedError); - assert(stub.calledOnce); - }); - }); - - describe('streamingAnalyzeContent', () => { - it('invokes streamingAnalyzeContent 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.StreamingAnalyzeContentRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse() - ); - client.innerApiCalls.streamingAnalyzeContent = stubBidiStreamingCall(expectedResponse); - const stream = client.streamingAnalyzeContent(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse) => { - 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.streamingAnalyzeContent as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes streamingAnalyzeContent 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.StreamingAnalyzeContentRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.streamingAnalyzeContent = stubBidiStreamingCall(undefined, expectedError); - const stream = client.streamingAnalyzeContent(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.streamingAnalyzeContent as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListParticipantsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listParticipants as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listParticipants as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListParticipantsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listParticipants as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listParticipants as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListParticipantsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listParticipants = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listParticipants(request), expectedError); - const actualRequest = (client.innerApiCalls.listParticipants as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listParticipants as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListParticipantsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listParticipants.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListParticipantsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listParticipants.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListParticipantsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listParticipants.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListParticipantsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listParticipants.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listSuggestions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSuggestions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listSuggestions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSuggestions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSuggestions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSuggestions(request), expectedError); - assert(stub.calledOnce); - const actualRequest = (client.innerApiCalls.listSuggestions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSuggestions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listSuggestions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listSuggestions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listSuggestions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listSuggestions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new participantsModule.v2beta1.ParticipantsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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/google-cloud-dialogflow/v2beta1/test/gapic_session_entity_types_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_session_entity_types_v2beta1.ts deleted file mode 100644 index 9a4a1157584..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_session_entity_types_v2beta1.ts +++ /dev/null @@ -1,2687 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.sessionEntityTypesStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sessionEntityTypesStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getSessionEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSessionEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getSessionEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSessionEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSessionEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSessionEntityType(request), expectedError); - const actualRequest = (client.innerApiCalls.getSessionEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSessionEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSessionEntityType with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSessionEntityType(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createSessionEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSessionEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createSessionEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSessionEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSessionEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSessionEntityType(request), expectedError); - const actualRequest = (client.innerApiCalls.createSessionEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSessionEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSessionEntityType with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createSessionEntityType(request), expectedError); - }); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest', ['sessionEntityType', 'name']); - request.sessionEntityType.name = defaultValue1; - const expectedHeaderRequestParams = `session_entity_type.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateSessionEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSessionEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest', ['sessionEntityType', 'name']); - request.sessionEntityType.name = defaultValue1; - const expectedHeaderRequestParams = `session_entity_type.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateSessionEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSessionEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest', ['sessionEntityType', 'name']); - request.sessionEntityType.name = defaultValue1; - const expectedHeaderRequestParams = `session_entity_type.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSessionEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSessionEntityType(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSessionEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSessionEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSessionEntityType with closed client', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest', ['sessionEntityType', 'name']); - request.sessionEntityType.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateSessionEntityType(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSessionEntityType = stubSimpleCall(expectedResponse); - const [response] = await client.deleteSessionEntityType(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSessionEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSessionEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.deleteSessionEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSessionEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSessionEntityType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteSessionEntityType(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSessionEntityType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSessionEntityType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSessionEntityType with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteSessionEntityType(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listSessionEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSessionEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listSessionEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSessionEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSessionEntityTypes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSessionEntityTypes(request), expectedError); - const actualRequest = (client.innerApiCalls.listSessionEntityTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSessionEntityTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listSessionEntityTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listSessionEntityTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listSessionEntityTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listSessionEntityTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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/google-cloud-dialogflow/v2beta1/test/gapic_sessions_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_sessions_v2beta1.ts deleted file mode 100644 index 5e5ca0ff2b3..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_sessions_v2beta1.ts +++ /dev/null @@ -1,2294 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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); -} - -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.SessionsClient', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.sessionsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sessionsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DetectIntentRequest', ['session']); - request.session = defaultValue1; - const expectedHeaderRequestParams = `session=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.detectIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.detectIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DetectIntentRequest', ['session']); - request.session = defaultValue1; - const expectedHeaderRequestParams = `session=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.detectIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.detectIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DetectIntentRequest', ['session']); - request.session = defaultValue1; - const expectedHeaderRequestParams = `session=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.detectIntent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.detectIntent(request), expectedError); - const actualRequest = (client.innerApiCalls.detectIntent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.detectIntent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes detectIntent with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DetectIntentRequest', ['session']); - request.session = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.detectIntent(request), expectedError); - }); - }); - - 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).calledWith(null)); - 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).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sessionsModule.v2beta1.SessionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - 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/google-cloud-dialogflow/v2beta1/test/gapic_versions_v2beta1.ts b/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_versions_v2beta1.ts deleted file mode 100644 index 7902144a2e3..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/v2beta1/test/gapic_versions_v2beta1.ts +++ /dev/null @@ -1,2649 +0,0 @@ -// Copyright 2022 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, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -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', () => { - describe('Common methods', () => { - 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 for the initialized client', done => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.versionsStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.versionsStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.getVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.getVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getVersion with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.GetVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getVersion(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.createVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.createVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createVersion with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.CreateVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createVersion(request), expectedError); - }); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateVersionRequest', ['version', 'name']); - request.version.name = defaultValue1; - const expectedHeaderRequestParams = `version.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateVersionRequest', ['version', 'name']); - request.version.name = defaultValue1; - const expectedHeaderRequestParams = `version.name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.updateVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateVersionRequest', ['version', 'name']); - request.version.name = defaultValue1; - const expectedHeaderRequestParams = `version.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.updateVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateVersion with closed client', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.UpdateVersionRequest', ['version', 'name']); - request.version.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateVersion(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteVersion = stubSimpleCall(expectedResponse); - const [response] = await client.deleteVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - 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); - const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteVersion with closed client', 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.DeleteVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteVersion(request), expectedError); - }); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;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); - const actualRequest = (client.innerApiCalls.listVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listVersions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listVersions(request), expectedError); - const actualRequest = (client.innerApiCalls.listVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.dialogflow.v2beta1.ListVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - 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( - (client.descriptors.page.listVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation 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 LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new versionsModule.v2beta1.VersionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - 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/google-cloud-dialogflow/v2beta1/tsconfig.json b/owl-bot-staging/google-cloud-dialogflow/v2beta1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/google-cloud-dialogflow/v2beta1/webpack.config.js b/owl-bot-staging/google-cloud-dialogflow/v2beta1/webpack.config.js deleted file mode 100644 index 0d2fc635111..00000000000 --- a/owl-bot-staging/google-cloud-dialogflow/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/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/participant.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/participant.proto index a39d49fb527..f6b385077de 100644 --- a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/participant.proto +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/participant.proto @@ -836,6 +836,11 @@ message AutomatedAgentReply { // later reply message arrives. e.g. if the agent specified some music as // partial response, it can be cancelled. bool allow_cancellation = 8; + + // The unique identifier of the current Dialogflow CX conversation page. + // Format: `projects//locations//agents//flows//pages/`. + string cx_current_page = 11; } // Represents article answer. diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/session.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/session.proto index 107e02060a3..85119ecc531 100644 --- a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/session.proto +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/session.proto @@ -689,7 +689,9 @@ message SentimentAnalysisResult { } // The sentiment, such as positive/negative feeling or association, for a unit -// of analysis, such as the query text. +// of analysis, such as the query text. See: +// https://cloud.google.com/natural-language/docs/basics#interpreting_sentiment_analysis_values +// for how to interpret the result. message Sentiment { // Sentiment score between -1.0 (negative sentiment) and 1.0 (positive // sentiment). diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/participant.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/participant.proto index 1f7309b6e3a..887a84015ce 100644 --- a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/participant.proto +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/participant.proto @@ -494,6 +494,11 @@ message AutomatedAgentReply { // later reply message arrives. e.g. if the agent specified some music as // partial response, it can be cancelled. bool allow_cancellation = 8; + + // The unique identifier of the current Dialogflow CX conversation page. + // Format: `projects//locations//agents//flows//pages/`. + string cx_current_page = 11; } // The type of Human Agent Assistant API suggestion to perform, and the maximum diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/session.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/session.proto index ac64e712789..4f45bce45bb 100644 --- a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/session.proto +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/session.proto @@ -827,7 +827,9 @@ message SentimentAnalysisResult { } // The sentiment, such as positive/negative feeling or association, for a unit -// of analysis, such as the query text. +// of analysis, such as the query text. See: +// https://cloud.google.com/natural-language/docs/basics#interpreting_sentiment_analysis_values +// for how to interpret the result. message Sentiment { // Sentiment score between -1.0 (negative sentiment) and 1.0 (positive // sentiment). diff --git a/packages/google-cloud-dialogflow/protos/protos.d.ts b/packages/google-cloud-dialogflow/protos/protos.d.ts index e01ea55f797..e21db5f1761 100644 --- a/packages/google-cloud-dialogflow/protos/protos.d.ts +++ b/packages/google-cloud-dialogflow/protos/protos.d.ts @@ -5132,6 +5132,9 @@ export namespace google { /** AutomatedAgentReply allowCancellation */ allowCancellation?: (boolean|null); + + /** AutomatedAgentReply cxCurrentPage */ + cxCurrentPage?: (string|null); } /** Represents an AutomatedAgentReply. */ @@ -5152,6 +5155,9 @@ export namespace google { /** AutomatedAgentReply allowCancellation. */ public allowCancellation: boolean; + /** AutomatedAgentReply cxCurrentPage. */ + public cxCurrentPage: string; + /** * Creates a new AutomatedAgentReply instance using the specified properties. * @param [properties] Properties to set @@ -37195,6 +37201,9 @@ export namespace google { /** AutomatedAgentReply allowCancellation */ allowCancellation?: (boolean|null); + + /** AutomatedAgentReply cxCurrentPage */ + cxCurrentPage?: (string|null); } /** Represents an AutomatedAgentReply. */ @@ -37233,6 +37242,9 @@ export namespace google { /** AutomatedAgentReply allowCancellation. */ public allowCancellation: boolean; + /** AutomatedAgentReply cxCurrentPage. */ + public cxCurrentPage: string; + /** AutomatedAgentReply response. */ public response?: "detectIntentResponse"; diff --git a/packages/google-cloud-dialogflow/protos/protos.js b/packages/google-cloud-dialogflow/protos/protos.js index 3bfb1ff4e73..54dce9988df 100644 --- a/packages/google-cloud-dialogflow/protos/protos.js +++ b/packages/google-cloud-dialogflow/protos/protos.js @@ -12538,6 +12538,7 @@ * @property {google.cloud.dialogflow.v2.IDetectIntentResponse|null} [detectIntentResponse] AutomatedAgentReply detectIntentResponse * @property {google.cloud.dialogflow.v2.AutomatedAgentReply.AutomatedAgentReplyType|null} [automatedAgentReplyType] AutomatedAgentReply automatedAgentReplyType * @property {boolean|null} [allowCancellation] AutomatedAgentReply allowCancellation + * @property {string|null} [cxCurrentPage] AutomatedAgentReply cxCurrentPage */ /** @@ -12579,6 +12580,14 @@ */ AutomatedAgentReply.prototype.allowCancellation = false; + /** + * AutomatedAgentReply cxCurrentPage. + * @member {string} cxCurrentPage + * @memberof google.cloud.dialogflow.v2.AutomatedAgentReply + * @instance + */ + AutomatedAgentReply.prototype.cxCurrentPage = ""; + /** * Creates a new AutomatedAgentReply instance using the specified properties. * @function create @@ -12609,6 +12618,8 @@ writer.uint32(/* id 7, wireType 0 =*/56).int32(message.automatedAgentReplyType); if (message.allowCancellation != null && Object.hasOwnProperty.call(message, "allowCancellation")) writer.uint32(/* id 8, wireType 0 =*/64).bool(message.allowCancellation); + if (message.cxCurrentPage != null && Object.hasOwnProperty.call(message, "cxCurrentPage")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.cxCurrentPage); return writer; }; @@ -12655,6 +12666,10 @@ message.allowCancellation = reader.bool(); break; } + case 11: { + message.cxCurrentPage = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -12707,6 +12722,9 @@ if (message.allowCancellation != null && message.hasOwnProperty("allowCancellation")) if (typeof message.allowCancellation !== "boolean") return "allowCancellation: boolean expected"; + if (message.cxCurrentPage != null && message.hasOwnProperty("cxCurrentPage")) + if (!$util.isString(message.cxCurrentPage)) + return "cxCurrentPage: string expected"; return null; }; @@ -12749,6 +12767,8 @@ } if (object.allowCancellation != null) message.allowCancellation = Boolean(object.allowCancellation); + if (object.cxCurrentPage != null) + message.cxCurrentPage = String(object.cxCurrentPage); return message; }; @@ -12769,6 +12789,7 @@ object.detectIntentResponse = null; object.automatedAgentReplyType = options.enums === String ? "AUTOMATED_AGENT_REPLY_TYPE_UNSPECIFIED" : 0; object.allowCancellation = false; + object.cxCurrentPage = ""; } if (message.detectIntentResponse != null && message.hasOwnProperty("detectIntentResponse")) object.detectIntentResponse = $root.google.cloud.dialogflow.v2.DetectIntentResponse.toObject(message.detectIntentResponse, options); @@ -12776,6 +12797,8 @@ object.automatedAgentReplyType = options.enums === String ? $root.google.cloud.dialogflow.v2.AutomatedAgentReply.AutomatedAgentReplyType[message.automatedAgentReplyType] === undefined ? message.automatedAgentReplyType : $root.google.cloud.dialogflow.v2.AutomatedAgentReply.AutomatedAgentReplyType[message.automatedAgentReplyType] : message.automatedAgentReplyType; if (message.allowCancellation != null && message.hasOwnProperty("allowCancellation")) object.allowCancellation = message.allowCancellation; + if (message.cxCurrentPage != null && message.hasOwnProperty("cxCurrentPage")) + object.cxCurrentPage = message.cxCurrentPage; return object; }; @@ -89045,6 +89068,7 @@ * @property {google.protobuf.IStruct|null} [cxSessionParameters] AutomatedAgentReply cxSessionParameters * @property {google.cloud.dialogflow.v2beta1.AutomatedAgentReply.AutomatedAgentReplyType|null} [automatedAgentReplyType] AutomatedAgentReply automatedAgentReplyType * @property {boolean|null} [allowCancellation] AutomatedAgentReply allowCancellation + * @property {string|null} [cxCurrentPage] AutomatedAgentReply cxCurrentPage */ /** @@ -89135,6 +89159,14 @@ */ AutomatedAgentReply.prototype.allowCancellation = false; + /** + * AutomatedAgentReply cxCurrentPage. + * @member {string} cxCurrentPage + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentReply + * @instance + */ + AutomatedAgentReply.prototype.cxCurrentPage = ""; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -89203,6 +89235,8 @@ writer.uint32(/* id 9, wireType 5 =*/77).float(message.matchConfidence); if (message.parameters != null && Object.hasOwnProperty.call(message, "parameters")) $root.google.protobuf.Struct.encode(message.parameters, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.cxCurrentPage != null && Object.hasOwnProperty.call(message, "cxCurrentPage")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.cxCurrentPage); return writer; }; @@ -89275,6 +89309,10 @@ message.allowCancellation = reader.bool(); break; } + case 11: { + message.cxCurrentPage = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -89365,6 +89403,9 @@ if (message.allowCancellation != null && message.hasOwnProperty("allowCancellation")) if (typeof message.allowCancellation !== "boolean") return "allowCancellation: boolean expected"; + if (message.cxCurrentPage != null && message.hasOwnProperty("cxCurrentPage")) + if (!$util.isString(message.cxCurrentPage)) + return "cxCurrentPage: string expected"; return null; }; @@ -89433,6 +89474,8 @@ } if (object.allowCancellation != null) message.allowCancellation = Boolean(object.allowCancellation); + if (object.cxCurrentPage != null) + message.cxCurrentPage = String(object.cxCurrentPage); return message; }; @@ -89457,6 +89500,7 @@ object.allowCancellation = false; object.matchConfidence = 0; object.parameters = null; + object.cxCurrentPage = ""; } if (message.detectIntentResponse != null && message.hasOwnProperty("detectIntentResponse")) { object.detectIntentResponse = $root.google.cloud.dialogflow.v2beta1.DetectIntentResponse.toObject(message.detectIntentResponse, options); @@ -89488,6 +89532,8 @@ object.matchConfidence = options.json && !isFinite(message.matchConfidence) ? String(message.matchConfidence) : message.matchConfidence; if (message.parameters != null && message.hasOwnProperty("parameters")) object.parameters = $root.google.protobuf.Struct.toObject(message.parameters, options); + if (message.cxCurrentPage != null && message.hasOwnProperty("cxCurrentPage")) + object.cxCurrentPage = message.cxCurrentPage; return object; }; diff --git a/packages/google-cloud-dialogflow/protos/protos.json b/packages/google-cloud-dialogflow/protos/protos.json index fbdc8f8342a..1b17762459d 100644 --- a/packages/google-cloud-dialogflow/protos/protos.json +++ b/packages/google-cloud-dialogflow/protos/protos.json @@ -1700,6 +1700,10 @@ "allowCancellation": { "type": "bool", "id": 8 + }, + "cxCurrentPage": { + "type": "string", + "id": 11 } }, "nested": { @@ -11040,6 +11044,10 @@ "allowCancellation": { "type": "bool", "id": 8 + }, + "cxCurrentPage": { + "type": "string", + "id": 11 } }, "nested": {